diff --git a/internal/graphicsdriver/opengl/context.go b/internal/graphicsdriver/opengl/context.go index 3be3f5362..6cbdb1233 100644 --- a/internal/graphicsdriver/opengl/context.go +++ b/internal/graphicsdriver/opengl/context.go @@ -22,6 +22,7 @@ import ( "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver" "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl/gl" "github.com/hajimehoshi/ebiten/v2/internal/shaderir" + "github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl" ) type blendFactor int @@ -105,8 +106,6 @@ type context struct { highp bool highpOnce sync.Once initOnce sync.Once - - contextPlatform } func (c *context) bindTexture(t textureNative) { @@ -482,3 +481,10 @@ func (c *context) newElementArrayBuffer(size int) buffer { c.ctx.BufferInit(gl.ELEMENT_ARRAY_BUFFER, size, gl.DYNAMIC_DRAW) return buffer(b) } + +func (c *context) glslVersion() glsl.GLSLVersion { + if c.ctx.IsES() { + return glsl.GLSLVersionES300 + } + return glsl.GLSLVersionDefault +} diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go deleted file mode 100644 index 6644b52d2..000000000 --- a/internal/graphicsdriver/opengl/context_js.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 Hajime Hoshi -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package opengl - -import ( - "syscall/js" - - "github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl" -) - -type contextPlatform struct { - canvas js.Value -} - -func (c *context) glslVersion() glsl.GLSLVersion { - return glsl.GLSLVersionES300 -} diff --git a/internal/graphicsdriver/opengl/context_notjs.go b/internal/graphicsdriver/opengl/context_notjs.go deleted file mode 100644 index 2b11382e7..000000000 --- a/internal/graphicsdriver/opengl/context_notjs.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 Hajime Hoshi -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !js - -package opengl - -import ( - "github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl" -) - -type contextPlatform struct { -} - -func (c *context) glslVersion() glsl.GLSLVersion { - if c.ctx.IsES() { - return glsl.GLSLVersionES300 - } - return glsl.GLSLVersionDefault -} diff --git a/internal/graphicsdriver/opengl/graphics_js.go b/internal/graphicsdriver/opengl/graphics_js.go index 1fd3f1c1e..5187a9b04 100644 --- a/internal/graphicsdriver/opengl/graphics_js.go +++ b/internal/graphicsdriver/opengl/graphics_js.go @@ -43,8 +43,5 @@ func NewGraphics(canvas js.Value) (graphicsdriver.Graphics, error) { return nil, err } - g := newGraphics(ctx) - g.context.canvas = canvas - - return g, nil + return newGraphics(ctx), nil }