func Parse(binding *Binding, target interface{}) (extensions Extensions, errors Errors)
Parse parses a struct and parses struct tag annotations to identify the required OpenGL information. It fills the target struct with the results, and returns zero or more Errors if any defined requirements are not met. It also returns a sorted string list of all supported OpenGL extensions.
The struct tag key is `glcaps`. The struct tag syntax is a space-separated list of commands, optionally followed by a colon and a space-separated list of requirements.
Commands:
and command1 command2 - return true if command1 and command2 are true or command1 command2 - return true if either command1 or command2 are true not command - return the boolean opposite of a command ext GL_EXT_name - return true if the given extension is supported GetIntegerv GL_name - lookup and return an integer value GetFloatv GL_name - lookup and return a float value if command1 command2 command3 - if command1 is true, return the result of command2 otherwise return command3 eq|neq|lt|lte|gt|gte command1 command2 - return true if command1 ==/!=/</<=/>/>= command2 respectively value - a value literal (e.g. true, false, 123, 1.23, 128KiB)
Requirements:
required - generate an error if the result is not true eq|neq|lt|lte|gt|gte value - generate an error if the command is not ==, !=, <, <=, >, >= value respectively
Binding implements a binding between this package and a specific OpenGL implementation (e.g. a specific `go-gl` module).
type Binding struct { GetIntegerv func(name uint32, data *int32) GetFloatv func(name uint32, data *float32) GetString func(name uint32) string // required to return a Go string, not a C string! GetStringi func(name uint32, index uint32) string // required to return a Go string, not a C string! }
func (b *Binding) QueryExtensions() Extensions
QueryExtensions returns all extensions supported by the current OpenGL context as a sorted list of strings. It is an error to call this method if a current OpenGL context does not exist.
Error implements an error result type for reporting a capability that doesn't meet a requirement.
type Error struct { Field string // the name of the field in the struct that failed Tag string // the original tag string Requirement requirement // the requirement that failed Message string // a human-readable message }
type Errors []Error
Extensions is an ordered list of supported OpenGL extensions.
type Extensions []string
func (extensions Extensions) Contains(key string) bool
HaveExtension returns true iff the ordered list of supported OpenGL extensions contains a given extension.