diff --git a/gpu/backend.go b/gpu/backend.go index d58d2473..e33b1c5f 100644 --- a/gpu/backend.go +++ b/gpu/backend.go @@ -116,7 +116,7 @@ type Uniform interface{} type Buffer interface { BindVertex(stride, offset int) - Bind() + BindIndex() Release() } diff --git a/gpu/gl/backend.go b/gpu/gl/backend.go index 0e689521..c663cd56 100644 --- a/gpu/gl/backend.go +++ b/gpu/gl/backend.go @@ -174,7 +174,7 @@ func (b *Backend) NewBuffer(typ gpu.BufferType, data []byte) gpu.Buffer { panic("unsupported buffer type") } buf := &gpuBuffer{backend: b, obj: obj, typ: gltyp} - buf.Bind() + b.funcs.BindBuffer(gltyp, obj) b.funcs.BufferData(gltyp, data, STATIC_DRAW) return buf } @@ -395,8 +395,11 @@ func (b *Backend) setupVertexArrays() { } } -func (b *gpuBuffer) Bind() { - b.backend.funcs.BindBuffer(b.typ, b.obj) +func (b *gpuBuffer) BindIndex() { + if b.typ != ELEMENT_ARRAY_BUFFER { + panic("not an index buffer") + } + b.backend.funcs.BindBuffer(ELEMENT_ARRAY_BUFFER, b.obj) } func (f *gpuFramebuffer) IsComplete() error { diff --git a/gpu/path.go b/gpu/path.go index ec2f8e0e..0e6c6bba 100644 --- a/gpu/path.go +++ b/gpu/path.go @@ -294,7 +294,7 @@ func (s *stenciler) begin(sizes []image.Point) { s.ctx.ClearColor(0.0, 0.0, 0.0, 0.0) s.prog.Bind() s.progLayout.Bind() - s.indexBuf.Bind() + s.indexBuf.BindIndex() } func (s *stenciler) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data *pathData) {