gl

package
v1.12.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0, MIT Imports: 6 Imported by: 0

README

This is a fork of github.com/go-gl/gl/v2.1/gl with the below patch. This is now modified manually.

The original version is generated from github.com/hajimehoshi/glow's nocgo branch. This enables to remove dependencies on Cgo on Windows.

Now we are working on commiting this 'no-cgo' change to the official gl package. See https://github.com/go-gl/glow/pull/102.

Documentation

Overview

Package gl implements Go bindings to OpenGL.

Index

Constants

View Source
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 AttachShader(program uint32, shader uint32)

func BindAttribLocation

func BindAttribLocation(program uint32, index uint32, name *uint8)

func BindBuffer

func BindBuffer(target uint32, buffer uint32)

func BindFramebufferEXT

func BindFramebufferEXT(target uint32, framebuffer uint32)

func BindTexture

func BindTexture(target uint32, texture uint32)

func BlendFunc

func BlendFunc(sfactor uint32, dfactor uint32)

func BufferData

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

func BufferSubData

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

func CheckFramebufferStatusEXT

func CheckFramebufferStatusEXT(target uint32) uint32

func CompileShader

func CompileShader(shader uint32)

func CreateProgram

func CreateProgram() uint32

func CreateShader

func CreateShader(xtype uint32) uint32

func DeleteBuffers

func DeleteBuffers(n int32, buffers *uint32)

func DeleteFramebuffersEXT

func DeleteFramebuffersEXT(n int32, framebuffers *uint32)

func DeleteProgram

func DeleteProgram(program uint32)

func DeleteShader

func DeleteShader(shader uint32)

func DeleteTextures

func DeleteTextures(n int32, textures *uint32)

func DisableVertexAttribArray

func DisableVertexAttribArray(index uint32)

func DrawElements

func DrawElements(mode uint32, count int32, xtype uint32, indices uintptr)

func Enable

func Enable(cap uint32)

func EnableVertexAttribArray

func EnableVertexAttribArray(index uint32)

func Flush

func Flush()

func FramebufferTexture2DEXT

func FramebufferTexture2DEXT(target uint32, attachment uint32, textarget uint32, texture uint32, level int32)

func GenBuffers

func GenBuffers(n int32, buffers *uint32)

func GenFramebuffersEXT

func GenFramebuffersEXT(n int32, framebuffers *uint32)

func GenTextures

func GenTextures(n int32, textures *uint32)

func GetDoublei_v

func GetDoublei_v(target uint32, index uint32, data *float64)

func GetDoublei_vEXT

func GetDoublei_vEXT(pname uint32, index uint32, params *float64)

func GetError

func GetError() uint32

func GetFloati_v

func GetFloati_v(target uint32, index uint32, data *float32)

func GetFloati_vEXT

func GetFloati_vEXT(pname uint32, index uint32, params *float32)

func GetIntegeri_v

func GetIntegeri_v(target uint32, index uint32, data *int32)

func GetIntegerui64i_vNV

func GetIntegerui64i_vNV(value uint32, index uint32, result *uint64)

func GetIntegerv

func GetIntegerv(pname uint32, data *int32)

func GetPointeri_vEXT

func GetPointeri_vEXT(pname uint32, index uint32, params *unsafe.Pointer)

func GetProgramInfoLog

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

func GetProgramiv

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

func GetShaderInfoLog

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

func GetShaderiv

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

func GetTransformFeedbacki64_v

func GetTransformFeedbacki64_v(xfb uint32, pname uint32, index uint32, param *int64)

func GetTransformFeedbacki_v

func GetTransformFeedbacki_v(xfb uint32, pname uint32, index uint32, param *int32)

func GetUniformLocation

func GetUniformLocation(program uint32, name *uint8) int32

func GetUnsignedBytei_vEXT

func GetUnsignedBytei_vEXT(target uint32, index uint32, data *uint8)

func GetVertexArrayIntegeri_vEXT

func GetVertexArrayIntegeri_vEXT(vaobj uint32, index uint32, pname uint32, param *int32)

func GetVertexArrayPointeri_vEXT

func GetVertexArrayPointeri_vEXT(vaobj uint32, index uint32, pname uint32, param *unsafe.Pointer)

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

func IsFramebufferEXT

func IsFramebufferEXT(framebuffer uint32) bool

func IsProgram

func IsProgram(program uint32) bool

func IsTexture

func IsTexture(texture uint32) bool

func LinkProgram

func LinkProgram(program uint32)

func PixelStorei

func PixelStorei(pname uint32, param int32)

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 ReadPixels

func ReadPixels(x int32, y int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer)

func RendererDeviceString added in v1.11.5

func RendererDeviceString() string

func ShaderSource

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

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)

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)

func Uniform1f

func Uniform1f(location int32, v0 float32)

func Uniform1fv

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

func Uniform1i

func Uniform1i(location int32, v0 int32)

func Uniform2fv

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

func Uniform3fv

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

func Uniform4fv

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

func UniformMatrix2fv

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

func UniformMatrix3fv

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

func UniformMatrix4fv

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

func UseProgram

func UseProgram(program uint32)

func VertexAttribPointer

func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer uintptr)

func Viewport

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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