gl

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gl implements Go bindings to OpenGL.

This package was automatically generated using Glow:

https://github.com/go-gl/glow

Index

Constants

View Source
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 ActiveTexture

func ActiveTexture(texture uint32)

select active texture unit

func AttachShader

func AttachShader(program uint32, shader uint32)

Attaches a shader object to a program object

func BindBuffer

func BindBuffer(target uint32, buffer uint32)

bind a named buffer object

func BindFramebuffer

func BindFramebuffer(target uint32, framebuffer uint32)

bind a framebuffer to a framebuffer target

func BindTexture

func BindTexture(target uint32, texture uint32)

bind a named texture to a texturing target

func BindVertexArray

func BindVertexArray(array uint32)

bind a vertex array object

func BufferData

func BufferData(target uint32, size int, data unsafe.Pointer, usage uint32)

creates and initializes a buffer object's data store

func BufferSubData

func BufferSubData(target uint32, offset int, size int, data unsafe.Pointer)

updates a subset of a buffer object's data store

func CheckFramebufferStatus

func CheckFramebufferStatus(target uint32) uint32

check the completeness status of a framebuffer

func Clear

func Clear(mask uint32)

clear buffers to preset values

func ClearColor

func ClearColor(red float32, green float32, blue float32, alpha float32)

specify clear values for the color buffers

func CompileShader

func CompileShader(shader uint32)

Compiles a shader object

func CreateProgram

func CreateProgram() uint32

Creates a program object

func CreateShader

func CreateShader(xtype uint32) uint32

Creates a shader object

func DeleteBuffers

func DeleteBuffers(n int32, buffers *uint32)

delete named buffer objects

func DeleteFramebuffers

func DeleteFramebuffers(n int32, framebuffers *uint32)

delete framebuffer objects

func DeleteProgram

func DeleteProgram(program uint32)

Deletes a program object

func DeleteShader

func DeleteShader(shader uint32)

Deletes a shader object

func DeleteTextures

func DeleteTextures(n int32, textures *uint32)

delete named textures

func DeleteVertexArrays

func DeleteVertexArrays(n int32, arrays *uint32)

delete vertex array objects

func Disable

func Disable(cap uint32)

func DrawArrays

func DrawArrays(mode uint32, first int32, count int32)

render primitives from array data

func Enable

func Enable(cap uint32)

enable or disable server-side GL capabilities

func EnableVertexAttribArray

func EnableVertexAttribArray(index uint32)

Enable or disable a generic vertex attribute array

func Flush

func Flush()

force execution of GL commands in finite time

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 GenBuffers

func GenBuffers(n int32, buffers *uint32)

generate buffer object names

func GenFramebuffers

func GenFramebuffers(n int32, framebuffers *uint32)

generate framebuffer object names

func GenTextures

func GenTextures(n int32, textures *uint32)

generate texture names

func GenVertexArrays

func GenVertexArrays(n int32, arrays *uint32)

generate vertex array object names

func GetError

func GetError() uint32

return error information

func GetIntegerv

func GetIntegerv(pname uint32, data *int32)

func GetProgramInfoLog

func GetProgramInfoLog(program uint32, bufSize int32, length *int32, infoLog *uint8)

Returns the information log for a program object

func GetProgramiv

func GetProgramiv(program uint32, pname uint32, params *int32)

Returns a parameter from a program object

func GetShaderInfoLog

func GetShaderInfoLog(shader uint32, bufSize int32, length *int32, infoLog *uint8)

Returns the information log for a shader object

func GetShaderiv

func GetShaderiv(shader uint32, pname uint32, params *int32)

Returns a parameter from a shader object

func GetString

func GetString(name uint32) *uint8

return a string describing the current GL connection

func GetUniformLocation

func GetUniformLocation(program uint32, name *uint8) int32

Returns the location of a uniform variable

func GoStr

func GoStr(cstr *uint8) string

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

func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error

InitWithProcAddrFunc intializes the package using the specified OpenGL function pointer loading function. For more cases Init should be used instead.

func LinkProgram

func LinkProgram(program uint32)

Links a program object

func Ptr

func Ptr(data interface{}) unsafe.Pointer

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

func PtrOffset(offset int) unsafe.Pointer

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

func ShaderSource(shader uint32, count int32, xstring **uint8, length *int32)

Replaces the source code in a shader object

func Str

func Str(str string) *uint8

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

func Strs(strs ...string) (cstrs **uint8, free func())

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 TexParameteri(target uint32, pname uint32, param int32)

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 Uniform4f

func Uniform4f(location int32, v0 float32, v1 float32, v2 float32, v3 float32)

Specify the value of a uniform variable for the current program object

func Uniform4fv

func Uniform4fv(location int32, count int32, value *float32)

Specify the value of a uniform variable for the current program object

func UniformMatrix4fv

func UniformMatrix4fv(location int32, count int32, transpose bool, value *float32)

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

func VertexAttribPointerWithOffset

func VertexAttribPointerWithOffset(index uint32, size int32, xtype uint32, normalized bool, stride int32, offset uintptr)

func Viewport

func Viewport(x int32, y int32, width int32, height int32)

set the viewport

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL