diff --git a/internal/graphicsdriver/opengl/graphics.go b/internal/graphicsdriver/opengl/graphics.go index e48b0cd8b..81817c6ec 100644 --- a/internal/graphicsdriver/opengl/graphics.go +++ b/internal/graphicsdriver/opengl/graphics.go @@ -114,7 +114,10 @@ func (g *Graphics) SetVertices(vertices []float32, indices []uint16) { func (g *Graphics) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, colorM *affine.ColorM, filter driver.Filter, address driver.Address) error { g.drawCalled = true - if err := g.useProgram(mode, colorM, filter, address); err != nil { + + g.context.blendFunc(mode) + + if err := g.useProgram(colorM, filter, address); err != nil { return err } g.context.drawElements(indexLen, indexOffset*2) // 2 is uint16 size in bytes diff --git a/internal/graphicsdriver/opengl/program.go b/internal/graphicsdriver/opengl/program.go index 8b727ef7c..db66bb867 100644 --- a/internal/graphicsdriver/opengl/program.go +++ b/internal/graphicsdriver/opengl/program.go @@ -241,7 +241,7 @@ func areSameFloat32Array(a, b []float32) bool { } // useProgram uses the program (programTexture). -func (g *Graphics) useProgram(mode driver.CompositeMode, colorM *affine.ColorM, filter driver.Filter, address driver.Address) error { +func (g *Graphics) useProgram(colorM *affine.ColorM, filter driver.Filter, address driver.Address) error { destination := g.state.destination if destination == nil { panic("destination image is not set") @@ -257,8 +257,6 @@ func (g *Graphics) useProgram(mode driver.CompositeMode, colorM *affine.ColorM, dstW := destination.width srcW, srcH := source.width, source.height - g.context.blendFunc(mode) - program := g.state.programs[programKey{ useColorM: colorM != nil, filter: filter,