mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
graphics: Call BindBuffer only when the program was null
This commit is contained in:
parent
fac639f9b7
commit
b86860abcc
@ -272,15 +272,18 @@ func (s *openGLState) useProgram(proj []float32, texture opengl.Texture, dst, sr
|
|||||||
}
|
}
|
||||||
theArrayBufferLayout.enable(program)
|
theArrayBufferLayout.enable(program)
|
||||||
|
|
||||||
|
if s.lastProgram == zeroProgram {
|
||||||
|
c.BindBuffer(opengl.ArrayBuffer, s.arrayBuffer)
|
||||||
|
c.BindBuffer(opengl.ElementArrayBuffer, s.elementArrayBuffer)
|
||||||
|
c.UniformInt(program, "texture", 0)
|
||||||
|
}
|
||||||
|
|
||||||
s.lastProgram = program
|
s.lastProgram = program
|
||||||
s.lastProjectionMatrix = nil
|
s.lastProjectionMatrix = nil
|
||||||
s.lastColorMatrix = nil
|
s.lastColorMatrix = nil
|
||||||
s.lastColorMatrixTranslation = nil
|
s.lastColorMatrixTranslation = nil
|
||||||
s.lastSourceWidth = 0
|
s.lastSourceWidth = 0
|
||||||
s.lastSourceHeight = 0
|
s.lastSourceHeight = 0
|
||||||
c.BindBuffer(opengl.ArrayBuffer, s.arrayBuffer)
|
|
||||||
c.BindBuffer(opengl.ElementArrayBuffer, s.elementArrayBuffer)
|
|
||||||
c.UniformInt(program, "texture", 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !areSameFloat32Array(s.lastProjectionMatrix, proj) {
|
if !areSameFloat32Array(s.lastProjectionMatrix, proj) {
|
||||||
|
Loading…
Reference in New Issue
Block a user