diff --git a/pixelgl/error.go b/pixelgl/error.go index 9077856..48e5e90 100644 --- a/pixelgl/error.go +++ b/pixelgl/error.go @@ -5,12 +5,12 @@ import ( "github.com/pkg/errors" ) -// GetLastError returns (and consumes) the last error generated by OpenGL. +// getLastError returns (and consumes) the last error generated by OpenGL inside the current Do, DoErr or DoVal. // If no error has been generated, this function returns nil. // // Call this function only inside the OpenGL thread (Do, DoErr or DoVal function). It's not guaranteed // to work correctly outside of it, because the thread swallows extra unchecked errors. -func GetLastError() error { +func getLastError() error { err := uint32(gl.NO_ERROR) for e := gl.GetError(); e != gl.NO_ERROR; e = gl.GetError() { err = e diff --git a/pixelgl/texture.go b/pixelgl/texture.go index 06211f9..7d02e5e 100644 --- a/pixelgl/texture.go +++ b/pixelgl/texture.go @@ -34,7 +34,7 @@ func NewTexture(parent BeginEnder, width, height int, pixels []uint8) (*Texture, gl.BindTexture(gl.TEXTURE_2D, 0) - return GetLastError() + return getLastError() }) if err != nil { return nil, errors.Wrap(err, "failed to create a texture") diff --git a/pixelgl/thread.go b/pixelgl/thread.go index 555faef..03597da 100644 --- a/pixelgl/thread.go +++ b/pixelgl/thread.go @@ -16,7 +16,7 @@ func init() { go func() { runtime.LockOSThread() for f := range callQueue { - GetLastError() // swallow unchecked errors + getLastError() // swallow unchecked errors f() } }() diff --git a/pixelgl/vertex.go b/pixelgl/vertex.go index d46919a..8c0c09d 100644 --- a/pixelgl/vertex.go +++ b/pixelgl/vertex.go @@ -133,7 +133,7 @@ func NewVertexArray(parent BeginEnder, format VertexFormat, mode VertexDrawMode, gl.BindBuffer(gl.ARRAY_BUFFER, 0) gl.BindVertexArray(0) - return GetLastError() + return getLastError() }) if err != nil { return nil, errors.Wrap(err, "failed to create a vertex array") @@ -177,7 +177,7 @@ func (va *VertexArray) UpdateData(offset int, data []float64) error { gl.BindBuffer(gl.ARRAY_BUFFER, va.vbo) gl.BufferSubData(gl.ARRAY_BUFFER, 8*offset, 8*len(data), gl.Ptr(data)) gl.BindBuffer(gl.ARRAY_BUFFER, 0) - return GetLastError() + return getLastError() }) if err != nil { return errors.Wrap(err, "failed to update vertex array")