rename GetLastError -> getLastError
This commit is contained in:
parent
c5c93d9442
commit
2bf58a8f5b
|
@ -5,12 +5,12 @@ import (
|
||||||
"github.com/pkg/errors"
|
"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.
|
// 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
|
// 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.
|
// to work correctly outside of it, because the thread swallows extra unchecked errors.
|
||||||
func GetLastError() error {
|
func getLastError() error {
|
||||||
err := uint32(gl.NO_ERROR)
|
err := uint32(gl.NO_ERROR)
|
||||||
for e := gl.GetError(); e != gl.NO_ERROR; e = gl.GetError() {
|
for e := gl.GetError(); e != gl.NO_ERROR; e = gl.GetError() {
|
||||||
err = e
|
err = e
|
||||||
|
|
|
@ -34,7 +34,7 @@ func NewTexture(parent BeginEnder, width, height int, pixels []uint8) (*Texture,
|
||||||
|
|
||||||
gl.BindTexture(gl.TEXTURE_2D, 0)
|
gl.BindTexture(gl.TEXTURE_2D, 0)
|
||||||
|
|
||||||
return GetLastError()
|
return getLastError()
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to create a texture")
|
return nil, errors.Wrap(err, "failed to create a texture")
|
||||||
|
|
|
@ -16,7 +16,7 @@ func init() {
|
||||||
go func() {
|
go func() {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
for f := range callQueue {
|
for f := range callQueue {
|
||||||
GetLastError() // swallow unchecked errors
|
getLastError() // swallow unchecked errors
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -133,7 +133,7 @@ func NewVertexArray(parent BeginEnder, format VertexFormat, mode VertexDrawMode,
|
||||||
gl.BindBuffer(gl.ARRAY_BUFFER, 0)
|
gl.BindBuffer(gl.ARRAY_BUFFER, 0)
|
||||||
gl.BindVertexArray(0)
|
gl.BindVertexArray(0)
|
||||||
|
|
||||||
return GetLastError()
|
return getLastError()
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to create a vertex array")
|
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.BindBuffer(gl.ARRAY_BUFFER, va.vbo)
|
||||||
gl.BufferSubData(gl.ARRAY_BUFFER, 8*offset, 8*len(data), gl.Ptr(data))
|
gl.BufferSubData(gl.ARRAY_BUFFER, 8*offset, 8*len(data), gl.Ptr(data))
|
||||||
gl.BindBuffer(gl.ARRAY_BUFFER, 0)
|
gl.BindBuffer(gl.ARRAY_BUFFER, 0)
|
||||||
return GetLastError()
|
return getLastError()
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to update vertex array")
|
return errors.Wrap(err, "failed to update vertex array")
|
||||||
|
|
Loading…
Reference in New Issue