Skip to content

Commit

Permalink
Don't free a shared buffer unless on iOS (strange but seems to be true)
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Nov 27, 2019
1 parent 399d26b commit 068243f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
7 changes: 0 additions & 7 deletions internal/painter/gl/gl_gomobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,6 @@ func (p *glPainter) glCreateBuffer(points []float32) Buffer {
return Buffer(sharedBuffer)
}

func (p *glPainter) glFreeBuffer(vbo Buffer) {
ctx := p.glctx()

ctx.BindBuffer(gl.ARRAY_BUFFER, gl.Buffer(vbo))
ctx.DeleteBuffer(gl.Buffer(vbo))
}

func (p *glPainter) glDrawTexture(texture Texture, alpha float32) {
ctx := p.glctx()
ctx.Enable(gl.BLEND)
Expand Down
12 changes: 12 additions & 0 deletions internal/painter/gl/gl_gomobile_ios.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build ios

package gl

import "golang.org/x/mobile/gl"

func (p *glPainter) glFreeBuffer(vbo Buffer) {
ctx := p.glctx()

ctx.BindBuffer(gl.ARRAY_BUFFER, gl.Buffer(vbo))
ctx.DeleteBuffer(gl.Buffer(vbo))
}
7 changes: 7 additions & 0 deletions internal/painter/gl/gl_gomobile_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build !ios

package gl

func (p *glPainter) glFreeBuffer(_ Buffer) {
// we don't free a shared buffer!
}

0 comments on commit 068243f

Please sign in to comment.