diff --git a/internal/graphics/internal/shader/program.go b/internal/graphics/internal/shader/program.go index b6faaae35..f1a52b1a8 100644 --- a/internal/graphics/internal/shader/program.go +++ b/internal/graphics/internal/shader/program.go @@ -95,7 +95,7 @@ func (p programFinisher) FinishProgram() { } func useProgramTexture(c *opengl.Context, projectionMatrix []float32, texture opengl.Texture, geo Matrix, color Matrix) programFinisher { - if lastProgram != programTexture { + if !lastProgram.Equals(programTexture) { c.UseProgram(programTexture) lastProgram = programTexture } diff --git a/internal/opengl/context.go b/internal/opengl/context.go index e266a3407..3216481ef 100644 --- a/internal/opengl/context.go +++ b/internal/opengl/context.go @@ -26,6 +26,12 @@ type Texture int type Framebuffer int type Shader int type Program int + +// TODO: Remove this after the GopherJS bug was fixed (#159) +func (p Program) Equals(other Program) bool { + return p == other +} + type UniformLocation gl.UniformLocation type AttribLocation gl.AttribLocation diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index 7a84eee35..4bc880a0a 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -39,6 +39,11 @@ type Program struct { js.Object } +// TODO: Remove this after the GopherJS bug was fixed (#159) +func (p Program) Equals(other Program) bool { + return p.Object == other.Object +} + type UniformLocation struct { js.Object } @@ -151,7 +156,8 @@ var lastFramebuffer Framebuffer func (c *Context) SetViewport(f Framebuffer, width, height int) error { gl := c.gl - if lastFramebuffer != f { + // TODO: Fix this after the GopherJS bug was fixed (#159) + if lastFramebuffer.Object != f.Object { gl.Flush() lastFramebuffer = f }