rename GetLastError -> getLastError

This commit is contained in:
faiface 2016-11-23 18:23:05 +01:00
parent c5c93d9442
commit 2bf58a8f5b
4 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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")

View File

@ -16,7 +16,7 @@ func init() {
go func() {
runtime.LockOSThread()
for f := range callQueue {
GetLastError() // swallow unchecked errors
getLastError() // swallow unchecked errors
f()
}
}()

View File

@ -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")