Documentation ¶
Overview ¶
Package gl implements Go bindings to OpenGL.
This package was automatically generated using Glow:
https://github.com/go-gl/glow
Index ¶
- Constants
- func ActiveTexture(texture uint32)
- func AttachShader(program uint32, shader uint32)
- func BindBuffer(target uint32, buffer uint32)
- func BindFramebuffer(target uint32, framebuffer uint32)
- func BindTexture(target uint32, texture uint32)
- func BindVertexArray(array uint32)
- func BufferData(target uint32, size int, data unsafe.Pointer, usage uint32)
- func BufferSubData(target uint32, offset int, size int, data unsafe.Pointer)
- func CheckFramebufferStatus(target uint32) uint32
- func Clear(mask uint32)
- func ClearColor(red float32, green float32, blue float32, alpha float32)
- func CompileShader(shader uint32)
- func CreateProgram() uint32
- func CreateShader(xtype uint32) uint32
- func DeleteBuffers(n int32, buffers *uint32)
- func DeleteFramebuffers(n int32, framebuffers *uint32)
- func DeleteProgram(program uint32)
- func DeleteShader(shader uint32)
- func DeleteTextures(n int32, textures *uint32)
- func DeleteVertexArrays(n int32, arrays *uint32)
- func Disable(cap uint32)
- func DrawArrays(mode uint32, first int32, count int32)
- func Enable(cap uint32)
- func EnableVertexAttribArray(index uint32)
- func Flush()
- func FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, ...)
- func GenBuffers(n int32, buffers *uint32)
- func GenFramebuffers(n int32, framebuffers *uint32)
- func GenTextures(n int32, textures *uint32)
- func GenVertexArrays(n int32, arrays *uint32)
- func GetError() uint32
- func GetIntegerv(pname uint32, data *int32)
- 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 GetString(name uint32) *uint8
- func GetUniformLocation(program uint32, name *uint8) int32
- func GoStr(cstr *uint8) string
- func Init() error
- func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error
- func LinkProgram(program uint32)
- func Ptr(data interface{}) unsafe.Pointer
- func PtrOffset(offset int) unsafe.Pointerdeprecated
- 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 Uniform4f(location int32, v0 float32, v1 float32, v2 float32, v3 float32)
- func Uniform4fv(location int32, count int32, 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 VertexAttribPointerWithOffset(index uint32, size int32, xtype uint32, normalized bool, stride int32, ...)
- func Viewport(x int32, y int32, width int32, height int32)
Constants ¶
const ( ARRAY_BUFFER = 0x8892 BLEND = 0x0BE2 CLAMP_TO_BORDER = 0x812D CLAMP_TO_EDGE = 0x812F COLOR_ATTACHMENT0 = 0x8CE0 COLOR_BUFFER_BIT = 0x00004000 COMPILE_STATUS = 0x8B81 CONTEXT_LOST = 0x0507 DRAW_FRAMEBUFFER = 0x8CA9 DYNAMIC_DRAW = 0x88E8 FALSE = 0 FLOAT = 0x1406 FRAGMENT_SHADER = 0x8B30 FRAMEBUFFER_COMPLETE = 0x8CD5 GEOMETRY_SHADER = 0x8DD9 INFO_LOG_LENGTH = 0x8B84 INVALID_ENUM = 0x0500 INVALID_OPERATION = 0x0502 INVALID_VALUE = 0x0501 LINEAR = 0x2601 LINK_STATUS = 0x8B82 MAX_TEXTURE_SIZE = 0x0D33 NEAREST = 0x2600 NO_ERROR = 0 OUT_OF_MEMORY = 0x0505 POINTS = 0x0000 RENDERER = 0x1F01 RGBA = 0x1908 RGBA8 = 0x8058 SHADING_LANGUAGE_VERSION = 0x8B8C STACK_OVERFLOW = 0x0503 STACK_UNDERFLOW = 0x0504 TEXTURE0 = 0x84C0 TEXTURE_2D = 0x0DE1 TEXTURE_MAG_FILTER = 0x2800 TEXTURE_MIN_FILTER = 0x2801 TEXTURE_WRAP_S = 0x2802 TEXTURE_WRAP_T = 0x2803 UNSIGNED_BYTE = 0x1401 VENDOR = 0x1F00 VERSION = 0x1F02 VERTEX_SHADER = 0x8B31 )
Variables ¶
This section is empty.
Functions ¶
func AttachShader ¶
Attaches a shader object to a program object
func BindFramebuffer ¶
bind a framebuffer to a framebuffer target
func BindTexture ¶
bind a named texture to a texturing target
func BufferData ¶
creates and initializes a buffer object's data store
func BufferSubData ¶
updates a subset of a buffer object's data store
func CheckFramebufferStatus ¶
check the completeness status of a framebuffer
func ClearColor ¶
specify clear values for the color buffers
func DeleteFramebuffers ¶
delete framebuffer objects
func DeleteVertexArrays ¶
delete vertex array objects
func DrawArrays ¶
render primitives from array data
func EnableVertexAttribArray ¶
func EnableVertexAttribArray(index uint32)
Enable or disable a generic vertex attribute array
func FramebufferTexture2D ¶
func FramebufferTexture2D(target uint32, attachment uint32, textarget uint32, texture uint32, level int32)
attach a level of a texture object as a logical buffer to the currently bound framebuffer object
func GenFramebuffers ¶
generate framebuffer object names
func GenVertexArrays ¶
generate vertex array object names
func GetIntegerv ¶
func GetProgramInfoLog ¶
Returns the information log for a program object
func GetProgramiv ¶
Returns a parameter from a program object
func GetShaderInfoLog ¶
Returns the information log for a shader object
func GetShaderiv ¶
Returns a parameter from a shader object
func GetUniformLocation ¶
Returns the location of a uniform variable
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 instead.
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 PtrOffset
deprecated
PtrOffset takes a pointer offset and returns a GL-compatible pointer. Originally intended for functions such as glVertexAttribPointer that take pointer parameters also for offsets, since Go 1.14 this is no longer recommended.
Use a corresponding offset-compatible variant of the function instead. For example, for gl.VertexAttribPointer() there is gl.VertexAttribPointerWithOffset().
See https://github.com/go-gl/gl#go-114-and-checkptr for more details on the checkptr detector. See https://github.com/go-gl/glow#overloads, about adding new overloads.
Deprecated: Use more appropriate overload function instead
func ShaderSource ¶
Replaces the source code in a shader object
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 TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer)
specify a two-dimensional texture image
func TexParameteri ¶
func TexSubImage2D ¶
func TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer)
specify a two-dimensional texture subimage
func Uniform4fv ¶
Specify the value of a uniform variable for the current program object
func UniformMatrix4fv ¶
Specify the value of a uniform variable for the current program object
func UseProgram ¶
func UseProgram(program uint32)
Installs a program object as part of current rendering state
func VertexAttribPointer ¶
func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer unsafe.Pointer)
define an array of generic vertex attribute data
Types ¶
This section is empty.