diff --git a/internal/graphics/internal/shader/program.go b/internal/graphics/internal/shader/program.go index 6018f62de..1533c44c8 100644 --- a/internal/graphics/internal/shader/program.go +++ b/internal/graphics/internal/shader/program.go @@ -67,7 +67,7 @@ func initialize(c *opengl.Context) error { var lastProgram opengl.Program func useProgramColorMatrix(c *opengl.Context, projectionMatrix []float32, geo Matrix, color Matrix) opengl.Program { - if lastProgram != programColorMatrix { + if !lastProgram.Equals(programColorMatrix) { c.UseProgram(programColorMatrix) lastProgram = programColorMatrix } diff --git a/internal/opengl/context.go b/internal/opengl/context.go index 9e593d28f..4de5f08ab 100644 --- a/internal/opengl/context.go +++ b/internal/opengl/context.go @@ -26,8 +26,14 @@ type Texture int type Framebuffer int type Shader int type Program int -type UniformLocation int -type AttribLocation 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 type context struct{} diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index 3ffc15cdd..7690205df 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 } @@ -141,7 +146,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 }