mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
graphicsdriver/opengl: Refactoring
This commit is contained in:
parent
9cc128fb40
commit
8ab12827c0
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user