Documentation ¶
Overview ¶
Package gl implements Go bindings to OpenGL.
Index ¶
- Constants
- func ActiveTexture(texture uint32)
- func AttachShader(program uint32, shader uint32)
- func BindAttribLocation(program uint32, index uint32, name *uint8)
- func BindBuffer(target uint32, buffer uint32)
- func BindFramebufferEXT(target uint32, framebuffer uint32)
- func BindTexture(target uint32, texture uint32)
- func BlendFunc(sfactor uint32, dfactor uint32)
- func BufferData(target uint32, size int, data unsafe.Pointer, usage uint32)
- func BufferSubData(target uint32, offset int, size int, data unsafe.Pointer)
- func CheckFramebufferStatusEXT(target uint32) uint32
- func CompileShader(shader uint32)
- func CreateProgram() uint32
- func CreateShader(xtype uint32) uint32
- func DeleteBuffers(n int32, buffers *uint32)
- func DeleteFramebuffersEXT(n int32, framebuffers *uint32)
- func DeleteProgram(program uint32)
- func DeleteShader(shader uint32)
- func DeleteTextures(n int32, textures *uint32)
- func DisableVertexAttribArray(index uint32)
- func DrawElements(mode uint32, count int32, xtype uint32, indices uintptr)
- func Enable(cap uint32)
- func EnableVertexAttribArray(index uint32)
- func Flush()
- func FramebufferTexture2DEXT(target uint32, attachment uint32, textarget uint32, texture uint32, ...)
- func GenBuffers(n int32, buffers *uint32)
- func GenFramebuffersEXT(n int32, framebuffers *uint32)
- func GenTextures(n int32, textures *uint32)
- func GetDoublei_v(target uint32, index uint32, data *float64)
- func GetDoublei_vEXT(pname uint32, index uint32, params *float64)
- func GetError() uint32
- func GetFloati_v(target uint32, index uint32, data *float32)
- func GetFloati_vEXT(pname uint32, index uint32, params *float32)
- func GetIntegeri_v(target uint32, index uint32, data *int32)
- func GetIntegerui64i_vNV(value uint32, index uint32, result *uint64)
- func GetIntegerv(pname uint32, data *int32)
- func GetPointeri_vEXT(pname uint32, index uint32, params *unsafe.Pointer)
- func GetProgramInfoLog(program uint32, bufSize int32, length *int32, infoLog *uint8)
- func GetProgramiv(program uint32, pname uint32, params *int32)
- func GetShaderInfoLog(shader uint32, bufSize int32, length *int32, infoLog *uint8)
- func GetShaderiv(shader uint32, pname uint32, params *int32)
- func GetTransformFeedbacki64_v(xfb uint32, pname uint32, index uint32, param *int64)
- func GetTransformFeedbacki_v(xfb uint32, pname uint32, index uint32, param *int32)
- func GetUniformLocation(program uint32, name *uint8) int32
- func GetUnsignedBytei_vEXT(target uint32, index uint32, data *uint8)
- func GetVertexArrayIntegeri_vEXT(vaobj uint32, index uint32, pname uint32, param *int32)
- func GetVertexArrayPointeri_vEXT(vaobj uint32, index uint32, pname uint32, param *unsafe.Pointer)
- func GoStr(cstr *uint8) string
- func Init() error
- func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error
- func IsFramebufferEXT(framebuffer uint32) bool
- func IsProgram(program uint32) bool
- func IsTexture(texture uint32) bool
- func LinkProgram(program uint32)
- func PixelStorei(pname uint32, param int32)
- func Ptr(data interface{}) unsafe.Pointer
- func ReadPixels(x int32, y int32, width int32, height int32, format uint32, xtype uint32, ...)
- func RendererDeviceString() string
- func ShaderSource(shader uint32, count int32, xstring **uint8, length *int32)
- func Str(str string) *uint8
- func Strs(strs ...string) (cstrs **uint8, free func())
- func TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, ...)
- func TexParameteri(target uint32, pname uint32, param int32)
- func TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, ...)
- func Uniform1f(location int32, v0 float32)
- func Uniform1fv(location int32, count int32, value *float32)
- func Uniform1i(location int32, v0 int32)
- func Uniform2fv(location int32, count int32, value *float32)
- func Uniform3fv(location int32, count int32, value *float32)
- func Uniform4fv(location int32, count int32, value *float32)
- func UniformMatrix2fv(location int32, count int32, transpose bool, value *float32)
- func UniformMatrix3fv(location int32, count int32, transpose bool, value *float32)
- func UniformMatrix4fv(location int32, count int32, transpose bool, value *float32)
- func UseProgram(program uint32)
- func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, ...)
- func Viewport(x int32, y int32, width int32, height int32)
Constants ¶
const ( VERTEX_SHADER = 0x8B31 FRAGMENT_SHADER = 0x8B30 ARRAY_BUFFER = 0x8892 ELEMENT_ARRAY_BUFFER = 0x8893 DYNAMIC_DRAW = 0x88E8 STREAM_DRAW = 0x88E0 PIXEL_UNPACK_BUFFER = 0x88EC SHORT = 0x1402 FLOAT = 0x1406 ZERO = 0 ONE = 1 SRC_ALPHA = 0x0302 DST_ALPHA = 0x0304 ONE_MINUS_SRC_ALPHA = 0x0303 ONE_MINUS_DST_ALPHA = 0x0305 DST_COLOR = 0x0306 FALSE = 0 TRUE = 1 BLEND = 0x0BE2 CLAMP_TO_EDGE = 0x812F COLOR_ATTACHMENT0 = 0x8CE0 COMPILE_STATUS = 0x8B81 FRAMEBUFFER = 0x8D40 FRAMEBUFFER_BINDING = 0x8CA6 FRAMEBUFFER_COMPLETE = 0x8CD5 INFO_LOG_LENGTH = 0x8B84 LINK_STATUS = 0x8B82 MAX_TEXTURE_SIZE = 0x0D33 NEAREST = 0x2600 NO_ERROR = 0 READ_WRITE = 0x88BA RGBA = 0x1908 TEXTURE0 = 0x84C0 TEXTURE_2D = 0x0DE1 TEXTURE_MAG_FILTER = 0x2800 TEXTURE_MIN_FILTER = 0x2801 TEXTURE_WRAP_S = 0x2802 TEXTURE_WRAP_T = 0x2803 TRIANGLES = 0x0004 UNPACK_ALIGNMENT = 0x0CF5 UNSIGNED_BYTE = 0x1401 UNSIGNED_SHORT = 0x1403 WRITE_ONLY = 0x88B9 )
Variables ¶
This section is empty.
Functions ¶
func ActiveTexture ¶
func ActiveTexture(texture uint32)
func AttachShader ¶
func BindAttribLocation ¶
func BindBuffer ¶
func BindFramebufferEXT ¶
func BindTexture ¶
func CompileShader ¶
func CompileShader(shader uint32)
func CreateProgram ¶
func CreateProgram() uint32
func CreateShader ¶
func DeleteBuffers ¶
func DeleteFramebuffersEXT ¶
func DeleteProgram ¶
func DeleteProgram(program uint32)
func DeleteShader ¶
func DeleteShader(shader uint32)
func DeleteTextures ¶
func DisableVertexAttribArray ¶
func DisableVertexAttribArray(index uint32)
func EnableVertexAttribArray ¶
func EnableVertexAttribArray(index uint32)
func FramebufferTexture2DEXT ¶
func GenBuffers ¶
func GenFramebuffersEXT ¶
func GenTextures ¶
func GetDoublei_v ¶
func GetDoublei_vEXT ¶
func GetFloati_v ¶
func GetFloati_vEXT ¶
func GetIntegeri_v ¶
func GetIntegerui64i_vNV ¶
func GetIntegerv ¶
func GetProgramInfoLog ¶
func GetProgramiv ¶
func GetShaderInfoLog ¶
func GetShaderiv ¶
func GetTransformFeedbacki_v ¶
func GetUniformLocation ¶
func GetUnsignedBytei_vEXT ¶
func GoStr ¶
GoStr takes a null-terminated string returned by OpenGL and constructs a corresponding Go string.
func Init ¶
func Init() error
Init initializes the OpenGL bindings by loading the function pointers (for each OpenGL function) from the active OpenGL context.
It must be called under the presence of an active OpenGL context, e.g., always after calling window.MakeContextCurrent() and always before calling any OpenGL functions exported by this package.
On Windows, Init loads pointers that are context-specific (and hence you must re-init if switching between OpenGL contexts, although not calling Init again after switching between OpenGL contexts may work if the contexts belong to the same graphics driver/device).
On macOS and the other POSIX systems, the behavior is different, but code written compatible with the Windows behavior is compatible with macOS and the other POSIX systems. That is, always Init under an active OpenGL context, and always re-init after switching graphics contexts.
For information about caveats of Init, you should read the "Platform Specific Function Retrieval" section of https://www.opengl.org/wiki/Load_OpenGL_Functions.
func InitWithProcAddrFunc ¶
InitWithProcAddrFunc intializes the package using the specified OpenGL function pointer loading function. For more cases Init should be used
func IsFramebufferEXT ¶
func LinkProgram ¶
func LinkProgram(program uint32)
func PixelStorei ¶
func Ptr ¶
Ptr takes a slice or pointer (to a singular scalar value or the first element of an array or slice) and returns its GL-compatible address.
For example:
var data []uint8 ... gl.TexImage2D(gl.TEXTURE_2D, ..., gl.UNSIGNED_BYTE, gl.Ptr(&data[0]))
func ReadPixels ¶
func RendererDeviceString ¶ added in v1.11.5
func RendererDeviceString() string
func Str ¶
Str takes a null-terminated Go string and returns its GL-compatible address. This function reaches into Go string storage in an unsafe way so the caller must ensure the string is not garbage collected.
func Strs ¶
Strs takes a list of Go strings (with or without null-termination) and returns their C counterpart.
The returned free function must be called once you are done using the strings in order to free the memory.
If no strings are provided as a parameter this function will panic.
func TexImage2D ¶
func TexParameteri ¶
func TexSubImage2D ¶
func Uniform1fv ¶
func Uniform2fv ¶
func Uniform3fv ¶
func Uniform4fv ¶
func UniformMatrix2fv ¶
func UniformMatrix3fv ¶
func UniformMatrix4fv ¶
func UseProgram ¶
func UseProgram(program uint32)
func VertexAttribPointer ¶
Types ¶
This section is empty.