Skip to content

Further development ideas

chsc edited this page Jan 27, 2013 · 2 revisions

Further development ideas

Automatic documentation generation

Package documentation that can be viewed with http://godoc.org.

Steps:

  1. Automatically download XML docs from: http://www.opengl.org/sdk/docs/man3/xhtml for each documented function.
  2. Extract parameter and brief description.
  3. Write function documentation to package.

Make some functions more idiomatic

  • 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
}

Get rid of gl.Uint, gl.Enum, gl.Float ... typedefs

  • 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, ...

GoGL sample programs

  • One gopher is not enough.

More utility functions

  • GL error code to string. Something like: gl.GetErrorString(err gl.Enum) string
  • More?

External utility library

  • package "github.com/chsc/gogl/glutil"
  • Conversion functions between Go images and GL textures
  • More Ideas?