diff --git a/internal/graphics/program.go b/internal/graphics/program.go index 833277668..8eb941dba 100644 --- a/internal/graphics/program.go +++ b/internal/graphics/program.go @@ -288,7 +288,8 @@ func (s *openGLState) useProgram(proj []float32, texture opengl.Texture, dst, sr s.lastColorMatrixTranslation = nil s.lastSourceWidth = 0 s.lastSourceHeight = 0 - c.BindElementArrayBuffer(s.elementArrayBuffer) + c.BindBuffer(opengl.ArrayBuffer, s.arrayBuffer) + c.BindBuffer(opengl.ElementArrayBuffer, s.elementArrayBuffer) c.UniformInt(program, "texture", 0) } diff --git a/internal/opengl/context_desktop.go b/internal/opengl/context_desktop.go index faaae3fc8..3a84aadce 100644 --- a/internal/opengl/context_desktop.go +++ b/internal/opengl/context_desktop.go @@ -465,9 +465,9 @@ func (c *Context) NewElementArrayBuffer(indices []uint16) Buffer { return buffer } -func (c *Context) BindElementArrayBuffer(b Buffer) { +func (c *Context) BindBuffer(bufferType BufferType, b Buffer) { _ = c.runOnContextThread(func() error { - gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, uint32(b)) + gl.BindBuffer(uint32(bufferType), uint32(b)) return nil }) } diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index d04a803dd..c8bc7c416 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -366,9 +366,9 @@ func (c *Context) NewElementArrayBuffer(indices []uint16) Buffer { return b } -func (c *Context) BindElementArrayBuffer(b Buffer) { +func (c *Context) BindBuffer(bufferType BufferType, b Buffer) { gl := c.gl - gl.Call("bindBuffer", gl.Get("ELEMENT_ARRAY_BUFFER"), b) + gl.Call("bindBuffer", int(bufferType), b) } func (c *Context) BufferSubData(bufferType BufferType, data []float32) { diff --git a/internal/opengl/context_mobile.go b/internal/opengl/context_mobile.go index fd851cfcd..afa8209a7 100644 --- a/internal/opengl/context_mobile.go +++ b/internal/opengl/context_mobile.go @@ -380,9 +380,9 @@ func (c *Context) NewElementArrayBuffer(indices []uint16) Buffer { return Buffer(b) } -func (c *Context) BindElementArrayBuffer(b Buffer) { +func (c *Context) BindBuffer(bufferType BufferType, b Buffer) { gl := c.gl - gl.BindBuffer(mgl.ELEMENT_ARRAY_BUFFER, mgl.Buffer(b)) + gl.BindBuffer(mgl.Enum(bufferType), mgl.Buffer(b)) } func float32ToBytes(v []float32) []byte {