import "golang.org/x/mobile/gl"

Package gl implements Go bindings for OpenGL ES 2.0 and ES 3.0.

The GL functions are defined on a Context object that is responsible for tracking a GL context. Typically a windowing system package (such as golang.org/x/exp/shiny/screen) will call NewContext and provide a gl.Context for a user application.

If the gl package is compiled on a platform capable of supporting ES 3.0, the gl.Context object also implements gl.Context3.

The bindings are deliberately minimal, staying as close the C API as possible. The semantics of each function maps onto functions described in the Khronos documentation:

https://www.khronos.org/opengles/sdk/docs/man/

One notable departure from the C API is the introduction of types to represent common uses of GLint: Texture, Surface, Buffer, etc.

A tracing version of the OpenGL bindings is behind the `gldebug` build tag. It acts as a simplified version of apitrace. Build your Go binary with

and each call to a GL function will log its input, output, and any error messages. For example,

The gldebug tracing has very high overhead, so make sure to remove the build tag before deploying any binaries.

consts.go doc.go fn.go gl.go interface.go types_prod.go work.go

GL ES 3.0 constants.

NewContext creates a cgo OpenGL context.

See the Worker interface for more details on how it is used.

Version returns a GL ES version string, either "GL_ES_2_0" or "GL_ES_3_0". Future versions of the gl package may return "GL_ES_3_1".

Attrib identifies the location of a specific attribute variable.

Buffer identifies a GL buffer object.