mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +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 openGLState
|
||||
|
||||
zeroBuffer opengl.Buffer
|
||||
zeroProgram opengl.Program
|
||||
)
|
||||
|
||||
@ -175,10 +176,14 @@ func (s *openGLState) reset() error {
|
||||
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()
|
||||
|
||||
if s.elementArrayBuffer != zeroBuffer {
|
||||
opengl.GetContext().DeleteBuffer(s.elementArrayBuffer)
|
||||
}
|
||||
indices := make([]uint16, 6*maxQuads)
|
||||
for i := uint16(0); i < maxQuads; i++ {
|
||||
indices[6*i+0] = 4*i + 0
|
||||
|
Loading…
Reference in New Issue
Block a user