mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
graphics: Bug fix: Delete buffer when necessary
This commit is contained in:
parent
ecc9d0b3b1
commit
e5ca84013c
@ -132,6 +132,7 @@ var (
|
|||||||
// theOpenGLState is the OpenGL state in the current process.
|
// theOpenGLState is the OpenGL state in the current process.
|
||||||
theOpenGLState openGLState
|
theOpenGLState openGLState
|
||||||
|
|
||||||
|
zeroBuffer opengl.Buffer
|
||||||
zeroProgram opengl.Program
|
zeroProgram opengl.Program
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -175,10 +176,14 @@ func (s *openGLState) reset() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Delete the array buffer and the element array buffer when needed?
|
if s.arrayBuffer != zeroBuffer {
|
||||||
|
opengl.GetContext().DeleteBuffer(s.arrayBuffer)
|
||||||
|
}
|
||||||
s.arrayBuffer = theArrayBufferLayout.newArrayBuffer()
|
s.arrayBuffer = theArrayBufferLayout.newArrayBuffer()
|
||||||
|
|
||||||
|
if s.elementArrayBuffer != zeroBuffer {
|
||||||
|
opengl.GetContext().DeleteBuffer(s.elementArrayBuffer)
|
||||||
|
}
|
||||||
indices := make([]uint16, 6*maxQuads)
|
indices := make([]uint16, 6*maxQuads)
|
||||||
for i := uint16(0); i < maxQuads; i++ {
|
for i := uint16(0); i < maxQuads; i++ {
|
||||||
indices[6*i+0] = 4*i + 0
|
indices[6*i+0] = 4*i + 0
|
||||||
|
Loading…
Reference in New Issue
Block a user