mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
graphics: Bug fix: Don't delete buffers on browsers (#526)
This commit is contained in:
parent
4c1cc9e699
commit
e5089934db
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||||
emath "github.com/hajimehoshi/ebiten/internal/math"
|
emath "github.com/hajimehoshi/ebiten/internal/math"
|
||||||
"github.com/hajimehoshi/ebiten/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/opengl"
|
||||||
|
"github.com/hajimehoshi/ebiten/internal/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
// arrayBufferLayoutPart is a part of an array buffer layout.
|
// arrayBufferLayoutPart is a part of an array buffer layout.
|
||||||
@ -163,11 +164,16 @@ func (s *openGLState) reset() error {
|
|||||||
if s.programScreen != zeroProgram {
|
if s.programScreen != zeroProgram {
|
||||||
opengl.GetContext().DeleteProgram(s.programScreen)
|
opengl.GetContext().DeleteProgram(s.programScreen)
|
||||||
}
|
}
|
||||||
if s.arrayBuffer != zeroBuffer {
|
|
||||||
opengl.GetContext().DeleteBuffer(s.arrayBuffer)
|
// On browsers (at least Chrome), buffers are already detached from the context
|
||||||
}
|
// and must not be deleted by DeleteBuffer.
|
||||||
if s.elementArrayBuffer != zeroBuffer {
|
if !web.IsBrowser() {
|
||||||
opengl.GetContext().DeleteBuffer(s.elementArrayBuffer)
|
if s.arrayBuffer != zeroBuffer {
|
||||||
|
opengl.GetContext().DeleteBuffer(s.arrayBuffer)
|
||||||
|
}
|
||||||
|
if s.elementArrayBuffer != zeroBuffer {
|
||||||
|
opengl.GetContext().DeleteBuffer(s.elementArrayBuffer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shaderVertexModelviewNative, err := opengl.GetContext().NewShader(opengl.VertexShader, shader(shaderVertexModelview))
|
shaderVertexModelviewNative, err := opengl.GetContext().NewShader(opengl.VertexShader, shader(shaderVertexModelview))
|
||||||
|
Loading…
Reference in New Issue
Block a user