-
Notifications
You must be signed in to change notification settings - Fork 16
Further development ideas
chsc edited this page Jan 27, 2013
·
2 revisions
Package documentation that can be viewed with http://godoc.org.
Steps:
- Automatically download XML docs from: http://www.opengl.org/sdk/docs/man3/xhtml for each documented function.
- Extract parameter and brief description.
- Write function documentation to package.
- Needs to be hand written.
- Especially for functions with string parameters/return values.
- "Ex" prefix for every convenient function?
Samples:
// Convenient function for glGetShaderInfoLog
func GetShaderInfoLogEx(shader Uint) string {
var length Int
GetShaderiv(shader, INFO_LOG_LENGTH, &length)
glStr := GLStringAlloc(Sizei(length))
GetShaderInfoLog(shader, Sizei(length), nil, glString)
goStr := GoString(glString)
GLStringFree(glString)
return goStr
}
// Convenient function for GetAttribLocation
func GetAttribLocationEx(program Uint, name string) Int {
glName := GLString(name)
attrLocation := GetAttribLocation(program, glName)
GLStringFree(glName)
return attrLocation
}
- Use native Go types instead: uint32, float32
- Pro: Nice code, less type casts
- Con: Slightly reduces type compatibility, because OpenGL defines only minimum sizes for GLInt, GLshort, ...
- One gopher is not enough.
- GL error code to string. Something like: gl.GetErrorString(err gl.Enum) string
- More?
- package "github.com/chsc/gogl/glutil"
- Conversion functions between Go images and GL textures
- More Ideas?