gl

package module
v0.0.0-...-df6f562 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2018 License: MIT Imports: 5 Imported by: 6

README

WORK IN PROGRESS - INCOMPLETE

This is a subset of OpenGL bindings meant to be easy to use from Go. They were made by generating bindings using Christoph Schunk's GoGL2 utility and modifying the output to be easier to use with Go. For example, setup functions like BindBuffer and CompileShader, that are not expected to be in a tight loop, return errors, and functions like glBufferData expect a slice of numbers and use reflection to figure out the other arguments. Additional type safety is achieved by explicitly defining types for OpenGL objects (Buffer, Program, etc).

Documentation

Overview

Package gl provides a set of modern OpenGL bindings. The bindings follow the OpenGL specification closely, with some adjustments to make it easier to use with Go's type system and capabilites. Only modern OpenGL functions that use the programmable rendering pipeline are provided.

Additional changes are added for safety and convenience. OpenGL enumerations are classified into types based on their usage, so using a value where it should not be, such as

gl.CreateShader(gl.ARRAY_BUFFER)

will result in a compile-time error. Initialization functions that are not often in performance-critical code paths perform error checking. The shader compilation routine will fetch the shader information log for you if an error occurs.

There are few, but some, deviations from the OpenGL naming schemes. Functions such as Uniform1f, Uniform2f, etc are collapsed into a single function of multiple arguments. Type enumerations follow after those of the reflect.Kind rather than the OpenGL identifiers. uintptr is used for offset arguments rather than unsafe.Pointer. Functions that upload data, such as BufferData, take fewer arguments and use reflection to discover the type and size of the data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveTexture

func ActiveTexture(tex Texture) error

func AttachShader

func AttachShader(p Program, s Shader) error

AttachShader binds a shader to a program. The shader should be initialized with ShaderSource or ShaderBinary before attaching.

func BindBuffer

func BindBuffer(t Target, b Buffer) error

Bind makes a Buffer the current active Buffer. http://www.opengl.org/sdk/docs/man3/xhtml/glBindBuffer.xml

func BindFramebuffer

func BindFramebuffer(t Target, b Framebuffer) error

func BindRenderbuffer

func BindRenderbuffer(t Target, b Renderbuffer) error

func BindTexture

func BindTexture(t Target, b Texture) error

func BindVertexArray

func BindVertexArray(vao VertexArray) error

func BlendColor

func BlendColor(r, g, b, a float32)

func BlendEquation

func BlendEquation(mode BlendMode)

func BlendEquationSeparate

func BlendEquationSeparate(rgb, alpha BlendMode)

func BlendFunc

func BlendFunc(src, dst BlendFn)

func BlendFuncSeparate

func BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha BlendFn)

func BufferData

func BufferData(t Target, data interface{}, hint UsageHint) error

BufferData uploads vertex data from the system into server memory. The argument data must be a slice or array of numeric values. Passing a nil or forbidden type will result in a run-time panic.

func BufferSubData

func BufferSubData(t Target, offset uintptr, data interface{}) error

BufferSubData replaces a portion of existing data in a buffer with new data from client memory. The target buffer must have already been initialized with BufferData, and the data to upload must be an array or slice of numeric values.

func Clear

func Clear(bit ClearFlags)

Clear clears buffers to preset values. https://www.opengl.org/sdk/docs/man3/xhtml/glClear.xml

func ClearColor

func ClearColor(r, g, b, a float32)

ClearColor defines the preset value to set the color buffer to when using Clear(COLOR_BUFFER_BIT) https://www.opengl.org/sdk/docs/man3/xhtml/glClearDepth.xml

func ClearDepth

func ClearDepth(depth float64)

ClearDepth defines the preset value to set the depth buffer to when using Clear(DEPTH_BUFFER_BIT) https://www.opengl.org/sdk/docs/man3/xhtml/glClearDepth.xml

func ClearStencil

func ClearStencil(index int)

ClearStencil defines the preset value to set the stencil buffer to when using Clear(STENCIL_BUFFER_BIT). https://www.opengl.org/sdk/docs/man3/xhtml/glClearStencil.xml

func CompileShader

func CompileShader(s Shader) error

CompileShader compiles a shader program to a binary format. If the shader source is invalid, the content of the shader's information log is returned as an error.

func CullFace

func CullFace(mode CullMode)

CullFace specifies whether front- or back-facing facets are culled. https://www.opengl.org/sdk/docs/man3/xhtml/glCullFace.xml

func DeleteBuffers

func DeleteBuffers(b []Buffer)

DeleteBuffers deletes several buffers at once.

func DeleteFramebuffers

func DeleteFramebuffers(b []Framebuffer)

func DeleteProgram

func DeleteProgram(p Program)

DeleteProgram deletes a GLSL program. Programs may not be immediately deleted; see https://www.opengl.org/sdk/docs/man3/xhtml/glDeleteProgram.xml

func DeleteRenderbuffers

func DeleteRenderbuffers(b []Renderbuffer)

func DeleteShader

func DeleteShader(s Shader)

DeleteShader deletes a given shader. It is legal to delete a shader after linking a program.

func DeleteTextures

func DeleteTextures(b []Texture)

func DeleteVertexArrays

func DeleteVertexArrays(b []VertexArray)

func DepthFunc

func DepthFunc(fn DepthFn)

func DepthMask

func DepthMask(on bool)

DepthMask enables or disables writing to the depth buffer. https://www.opengl.org/sdk/docs/man3/xhtml/glDepthMask.xml

func DetachShader

func DetachShader(p Program, s Shader) error

DetachShader detaches a shader from a Program; once a Program has been linked with LinkProgram, it is independent of its Shader objects and will continue to function if a shader is detached.

func Disable

func Disable(cap Capability)

func DisableVertexAttribArray

func DisableVertexAttribArray(a Attrib)

func DrawArrays

func DrawArrays(mode DrawMode, first, count int)

DrawArrays renders primitives from vertex data in ARRAY_BUFFER. A buffer should be bound to ARRAY_BUFFER with BindBuffer, and initialized with vertex data using BufferData before calling DrawArrays.

https://www.opengl.org/sdk/docs/man3/xhtml/glDrawArrays.xml

func DrawElements

func DrawElements(mode DrawMode, count int, typ Type, offset uintptr)

DrawElements draws vertices in the buffer object bound to ARRAY_BUFFER as selected by the indices in the buffer object bound to ELEMENT_ARRAY_BUFFER. https://www.opengl.org/sdk/docs/man3/xhtml/glDrawElements.xml

func DrawElementsBaseVertex

func DrawElementsBaseVertex(mode DrawMode, count int, typ Type, offset uintptr, base int)

DrawElementsBaseVertex draws in the same manner as DrawElements, but adds a fixed offset to each index in ELEMENT_ARRAY_BUFFER before selecting vertices. https://www.opengl.org/sdk/docs/man3/xhtml/glDrawElementsBaseVertex.xml

func Enable

func Enable(cap Capability)

func EnableVertexAttribArray

func EnableVertexAttribArray(a Attrib)

func FramebufferRenderbuffer

func FramebufferRenderbuffer(tgt Target, a Attachment, bufTgt Target, buf Renderbuffer) error

func FramebufferTexture2D

func FramebufferTexture2D(tgt Target, a Attachment, texTgt Target, tex Texture, lvl int) error

func FrontFace

func FrontFace(order WindingOrder)

FrontFace specifies the winding order when using facet culling. https://www.opengl.org/sdk/docs/man3/xhtml/glFrontFace.xml

func GetShaderSource

func GetShaderSource(s Shader) ([]byte, error)

GetShaderSource retrieves the source code for an existing GLSL shader program.

func GetString

func GetString(key Enum) string

GetString can be used to retrieve information about the loaded OpenGL implementation, such as the supported shader version.

func Init

func Init(hint string) error

Init loads the OpenGL functions using system-specific library loaders. The string hint is currently unused but reserved for future use.

func IsEnabled

func IsEnabled(cap Capability) bool

func LinkProgram

func LinkProgram(p Program) error

LinkProgram creates an executable to be run on the vertex processor. The Program must have compiled shader objects attached to it. Programs must be linked before calling UseProgram and any subsequent drawing calls.

func PointSize

func PointSize(diameter float32)

PointSize specifies the diameter of rasterized points.

https://www.opengl.org/sdk/docs/man/xhtml/glPointSize.xml

func ShaderSource

func ShaderSource(s Shader, src []byte) error

ShaderSource uploads the GLSL source code to a shader allocated with CreateShader. It does not attempt to check the source for errors.

func TexImage2D

func TexImage2D(tgt Target, lvl int, internal TexFormat, width, height int, format TexFormat, data interface{})

func TexParameter

func TexParameter(tgt Target, param TexParam, val interface{})

func Uniform1fv

func Uniform1fv(u Uniform, v []float32)

func Uniform1iv

func Uniform1iv(u Uniform, v []int)

func Uniform2fv

func Uniform2fv(u Uniform, v []float32)

func Uniform2iv

func Uniform2iv(u Uniform, v []int)

func Uniform3fv

func Uniform3fv(u Uniform, v []float32)

func Uniform3iv

func Uniform3iv(u Uniform, v []int)

func Uniform4fv

func Uniform4fv(u Uniform, v []float32)

func Uniform4iv

func Uniform4iv(u Uniform, v []int)

func UniformMatrix2fv

func UniformMatrix2fv(u Uniform, transpose bool, mat []float32)

func UniformMatrix3fv

func UniformMatrix3fv(u Uniform, transpose bool, mat []float32)

func UniformMatrix4fv

func UniformMatrix4fv(u Uniform, transpose bool, mat []float32)

func Uniformf

func Uniformf(u Uniform, v ...float32)

func Uniformi

func Uniformi(u Uniform, v ...int)

func UseProgram

func UseProgram(p Program) error

UseProgram installs the Program as part of the current rendering state. only one program may be used at a time.

func ValidateProgram

func ValidateProgram(p Program) error

ValidateProgram checks to see whether the executables contained in the Program can execute given the current OpenGL state. If an error occurs, the contents of the program information log are returned as an error.

func VertexAttribPointer

func VertexAttribPointer(a Attrib, size int, typ Type, normalize bool, stride, offset uintptr) error

func Viewport

func Viewport(x, y, w, h int)

Viewport sets the size and position of the screen within the window. https://www.opengl.org/sdk/docs/man3/xhtml/glViewport.xml

Types

type Attachment

type Attachment uint
const (
	DEPTH_ATTACHMENT   Attachment = 0x8D00
	STENCIL_ATTACHMENT Attachment = 0x8D20
	COLOR_ATTACHMENT0  Attachment = 0x8CE0
)

type Attrib

type Attrib uint32

func GetAttribLocation

func GetAttribLocation(p Program, name string) (Attrib, error)

type BlendFn

type BlendFn uint
const (
	ZERO                     BlendFn = 0x0000
	ONE                      BlendFn = 0x0001
	SRC_COLOR                BlendFn = 0x0300
	ONE_MINUS_SRC_COLOR      BlendFn = 0x0301
	DST_COLOR                BlendFn = 0x0306
	ONE_MINUS_DST_COLOR      BlendFn = 0x0307
	SRC_ALPHA                BlendFn = 0x0302
	ONE_MINUS_SRC_ALPHA      BlendFn = 0x0303
	DST_ALPHA                BlendFn = 0x0304
	ONE_MINUS_DST_ALPHA      BlendFn = 0x0305
	CONSTANT_COLOR           BlendFn = 0x8002
	ONE_MINUS_CONSTANT_COLOR BlendFn = 0x8002
	CONSTANT_ALPHA           BlendFn = 0x8003
	ONE_MINUS_CONSTANT_ALPHA BlendFn = 0x8004
)

type BlendMode

type BlendMode uint
const (
	FUNC_ADD              BlendMode = 0x8006
	FUNC_SUBTRACT         BlendMode = 0x800B
	FUNC_REVERSE_SUBTRACT BlendMode = 0x800A
	MIN                   BlendMode = 0x8007
	MAX                   BlendMode = 0x8008
)

type Buffer

type Buffer uint32

Buffers hold data in server memory. They can be bound to ARRAY_BUFFER with BindBuffer to hold vertex and color data uploaded with BufferData, or they can be bound to ELEMENT_ARRAY_BUFFER to reference vertices in another buffer.

func GenBuffers

func GenBuffers(n int) []Buffer

GenBuffers returns a slice of n buffer object names. https://www.opengl.org/sdk/docs/man3/xhtml/glGenBuffers.xml

type Capability

type Capability uint
const (
	BLEND                     Capability = 0x0BE2
	CLIP_DISTANCE0            Capability = 0x3000
	CLIP_DISTANCE1            Capability = 0x3001
	CLIP_DISTANCE2            Capability = 0x3002
	CLIP_DISTANCE3            Capability = 0x3003
	CLIP_DISTANCE4            Capability = 0x3004
	CLIP_DISTANCE5            Capability = 0x3005
	CLIP_DISTANCE6            Capability = 0x3006
	CLIP_DISTANCE7            Capability = 0x3007
	COLOR_LOGIC_OP            Capability = 0x0BF2
	CULL_FACE                 Capability = 0x0B44
	DEPTH_CLAMP               Capability = 0x864F
	DEPTH_TEST                Capability = 0x0B71
	DITHER                    Capability = 0x0BD0
	FRAMEBUFFER_SRGB          Capability = 0x8DB9
	LINE_SMOOTH               Capability = 0x0B20
	MULTISAMPLE               Capability = 0x809D
	POLYGON_OFFSET_FILL       Capability = 0x8037
	POLYGON_OFFSET_LINE       Capability = 0x2A02
	POLYGON_OFFSET_POINT      Capability = 0x2A01
	POLYGON_SMOOTH            Capability = 0x0B41
	POINT_SIZE                Capability = 0x0B11
	PRIMITIVE_RESTART         Capability = 0x8F9D
	PROGRAM_POINT_SIZE        Capability = 0x8642
	SAMPLE_ALPHA_TO_COVERAGE  Capability = 0x809E
	SAMPLE_ALPHA_TO_ONE       Capability = 0x809F
	SAMPLE_COVERAGE           Capability = 0x80A0
	SCISSOR_TEST              Capability = 0x0C11
	TEXTURE_CUBE_MAP_SEAMLESS Capability = 0x884F
)

type ClearFlags

type ClearFlags uint
const (
	COLOR_BUFFER_BIT   ClearFlags = 0x00004000
	DEPTH_BUFFER_BIT   ClearFlags = 0x00000100
	STENCIL_BUFFER_BIT ClearFlags = 0x00000400
)

type CullMode

type CullMode uint
const (
	BACK           CullMode = 0x0405
	FRONT          CullMode = 0x0404
	FRONT_AND_BACK CullMode = 0x0408
)

type DepthFn

type DepthFn uint
const (
	NEVER    DepthFn = 0x0200
	LESS     DepthFn = 0x0201
	EQUAL    DepthFn = 0x0202
	LEQUAL   DepthFn = 0x0203
	GREATER  DepthFn = 0x0204
	NOTEQUAL DepthFn = 0x0205
	GEQUAL   DepthFn = 0x0206
	ALWAYS   DepthFn = 0x0207
)

type DrawMode

type DrawMode uint

DrawMode informs OpenGL how to assemble vertex data into shapes.

const (
	POINTS         DrawMode = 0x0000 // Independent points
	LINE_STRIP     DrawMode = 0x0003 // Points connected with lines
	LINE_LOOP      DrawMode = 0x0002 // Line strip with first and last points joined
	LINES          DrawMode = 0x0001 // Series of two-point straigth lines
	TRIANGLE_STRIP DrawMode = 0x0005 // Triangle vertex N has vertices N-1, N-2
	TRIANGLE_FAN   DrawMode = 0x0006 // Triangles sharing same central vertex
	TRIANGLES      DrawMode = 0x0004 // Independent triangles
)

type Enum

type Enum uint
const (
	VENDOR                   Enum = 0x1F00
	RENDERER                 Enum = 0x1F01
	VERSION                  Enum = 0x1F02
	SHADING_LANGUAGE_VERSION Enum = 0x8B8C
)

type Error

type Error C.GLenum

func (*Error) Error

func (e *Error) Error() string

type Framebuffer

type Framebuffer uint32

Framebuffers are off-screen drawing destinations that can be used to render to Textures or Renderbuffers with the same GLSL drawing routines used to render to the display.

func GenFramebuffers

func GenFramebuffers(n int) []Framebuffer

GenFramebuffers returns a slice of n framebuffer object names. https://www.opengl.org/sdk/docs/man3/xhtml/glGenFramebuffers.xml

type Program

type Program uint

A GLSL program is a collection of GLSL programs sufficient for rasterizing vertex data. Programs must have at least a vertex and fragment shader, and may contain geometry and tesselation shaders.

func CreateProgram

func CreateProgram() Program

CreateProgram creates a fresh name for a collection of GLSL shaders.

type Renderbuffer

type Renderbuffer uint32

Renderbuffers provide storage for Framebuffer objects. They must be initialized with RenderBufferStorage and attached to a Framebuffer with FrameBufferRenderbuffer

func GenRenderbuffers

func GenRenderbuffers(n int) []Renderbuffer

GenRenderbuffers returns a slice of n renderbuffer object names. https://www.opengl.org/sdk/docs/man3/xhtml/glGenRenderbuffers.xml

type Shader

type Shader uint

A Shader is reference to a GLSL program.

func CreateShader

func CreateShader(t ShaderType) Shader

CreateShader creates a fresh name for a GLSL shader of the given type.

func (Shader) Type

func (s Shader) Type() ShaderType

type ShaderType

type ShaderType uint

Shaders have a type that describes where they sit in the rendering pipeline.

const (
	VERTEX_SHADER   ShaderType = 0x8B31
	FRAGMENT_SHADER ShaderType = 0x8B30
	GEOMETRY_SHADER ShaderType = 0x8DD9
)

type Target

type Target uint

A Target specifies the slot for a bound OpenGL object, such as a vertex buffer bound to ARRAY_BUFFER

const (
	ARRAY_BUFFER         Target = 0x8892
	ELEMENT_ARRAY_BUFFER Target = 0x8893
	FRAMEBUFFER          Target = 0x8D40
	RENDERBUFFER         Target = 0x8D41
	TEXTURE_1D           Target = 0x0DE0
	TEXTURE_2D           Target = 0x0DE1
	TEXTURE_3D           Target = 0x806F
	TEXTURE_BUFFER       Target = 0x8C2A
	TEXTURE_CUBE_MAP     Target = 0x8513
	TEXTURE_RECTANGLE    Target = 0x84F5
	UNIFORM_BUFFER       Target = 0x8A11
)

type TexFormat

type TexFormat uint

A TexFormat describes the representation of a texture in memory.

const (
	DEPTH_COMPONENT     TexFormat = 0x1902
	DEPTH_COMPONENT16   TexFormat = 0x81A5
	DEPTH_COMPONENT24   TexFormat = 0x81A6
	DEPTH_COMPONENT32   TexFormat = 0x81A7
	RED                 TexFormat = 0x1903
	RGB                 TexFormat = 0x1907
	RGBA                TexFormat = 0x1908
	RGBA12              TexFormat = 0x805A
	RGBA16              TexFormat = 0x805B
	RGBA2               TexFormat = 0x8055
	RGBA4               TexFormat = 0x8056
	RGBA8               TexFormat = 0x8058
	RGB4                TexFormat = 0x804F
	RGB5                TexFormat = 0x8050
	RGB8                TexFormat = 0x8051
	RGB565              TexFormat = 0x8D62
	RGB10               TexFormat = 0x8052
	RGB12               TexFormat = 0x8053
	RGB16               TexFormat = 0x8054
	INTENSITY           TexFormat = 0x8049
	INTENSITY12         TexFormat = 0x804C
	INTENSITY16         TexFormat = 0x804D
	INTENSITY4          TexFormat = 0x804A
	INTENSITY8          TexFormat = 0x804B
	LUMINANCE           TexFormat = 0x1909
	LUMINANCE12         TexFormat = 0x8041
	LUMINANCE12_ALPHA12 TexFormat = 0x8047
	LUMINANCE12_ALPHA4  TexFormat = 0x8046
	LUMINANCE16         TexFormat = 0x8042
	LUMINANCE16_ALPHA16 TexFormat = 0x8048
	LUMINANCE4          TexFormat = 0x803F
	LUMINANCE4_ALPHA4   TexFormat = 0x8043
	LUMINANCE6_ALPHA2   TexFormat = 0x8044
	LUMINANCE8          TexFormat = 0x8040
	LUMINANCE8_ALPHA8   TexFormat = 0x8045
	LUMINANCE_ALPHA     TexFormat = 0x190A
)

type TexParam

type TexParam uint
const (
	// (0) index of the lowest defined mipmap level
	TEXTURE_BASE_LEVEL TexParam = 0x813C
	// values that should be used for border texels
	TEXTURE_BORDER_COLOR TexParam = 0x1004
	// comparison when GL_TEXTURE_COMPARE_MODE is GL_COMPARE_REF_TO_TEXTURE
	TEXTURE_COMPARE_FUNC TexParam = 0x884D
	// comparison mode for currently bound depth textures
	TEXTURE_COMPARE_MODE TexParam = 0x884C
	// value that is to be added to the level-of-detail parameter for the texture before texture sampling
	TEXTURE_LOD_BIAS TexParam = 0x8501
	// Texture magnification function
	TEXTURE_MAG_FILTER TexParam = 0x2800
	// Index of the highest defined mipmap level
	TEXTURE_MAX_LEVEL TexParam = 0x813D
	// Sets the maximum level-of-detail parameter
	TEXTURE_MAX_LOD TexParam = 0x813B
	// The texture minifying function
	TEXTURE_MIN_FILTER TexParam = 0x2801
	// Sets the minimum level-of-detail parameter
	TEXTURE_MIN_LOD TexParam = 0x813A
	TEXTURE_WRAP_R  TexParam = 0x8072
	TEXTURE_WRAP_S  TexParam = 0x2802
	TEXTURE_WRAP_T  TexParam = 0x2803
)

type Texture

type Texture uint32

A texture is an OpenGL Object that contains one or more images that all have the same image format. Textures can be accessed from a shader, or used as a render target for a Framebuffer.

const (
	TEXTURE0  Texture = 0x84C0
	TEXTURE1  Texture = 0x84C1
	TEXTURE2  Texture = 0x84C2
	TEXTURE3  Texture = 0x84C3
	TEXTURE4  Texture = 0x84C4
	TEXTURE5  Texture = 0x84C5
	TEXTURE6  Texture = 0x84C6
	TEXTURE7  Texture = 0x84C7
	TEXTURE8  Texture = 0x84C8
	TEXTURE9  Texture = 0x84C9
	TEXTURE10 Texture = 0x84CA
	TEXTURE11 Texture = 0x84CB
	TEXTURE12 Texture = 0x84CC
	TEXTURE13 Texture = 0x84CD
	TEXTURE14 Texture = 0x84CE
	TEXTURE15 Texture = 0x84CF
	TEXTURE16 Texture = 0x84D0
	TEXTURE17 Texture = 0x84D1
	TEXTURE18 Texture = 0x84D2
	TEXTURE19 Texture = 0x84D3
	TEXTURE20 Texture = 0x84D4
	TEXTURE21 Texture = 0x84D5
	TEXTURE22 Texture = 0x84D6
	TEXTURE23 Texture = 0x84D7
	TEXTURE24 Texture = 0x84D8
	TEXTURE25 Texture = 0x84D9
	TEXTURE26 Texture = 0x84DA
	TEXTURE27 Texture = 0x84DB
	TEXTURE28 Texture = 0x84DC
	TEXTURE29 Texture = 0x84DD
	TEXTURE30 Texture = 0x84DE
	TEXTURE31 Texture = 0x84DF
)

func GenTextures

func GenTextures(n int) []Texture

GenTextures returns a slice of n Texture names. https://www.opengl.org/sdk/docs/man3/xhtml/glGenTextures.xml

type Type

type Type uint

A Type is an enumeration of an OpenGL type. The gl package names types after their Go counterparts, rather than the identifiers used in the OpenGL standard.

const (
	Float32 Type = 0x1406
	Float64 Type = 0x140A
	Int8    Type = 0x1400
	Int16   Type = 0x1402
	Int32   Type = 0x1404
	Uint8   Type = 0x1401
	Uint16  Type = 0x1403
	Uint32  Type = 0x1405
)

type Uniform

type Uniform int

A Uniform is a reference to a "global" variable in a GLSL program. Uniforms can be retrieved with GetUniformLocation and updated with the Uniform* functions

func GetUniformLocation

func GetUniformLocation(p Program, name string) (Uniform, error)

GetUniformLocation retrieves a reference to a GLSL uniform by matching its name in the GLSL source code. The return value is suitable as an argument to Uniformf, UniformMatrixf et. al.

type UsageHint

type UsageHint uint

A UsageHint informs OpenGL of the intended use case for a buffer object. The OpenGL implementation is not required to act on a UsageHint, but often will.

const (
	STREAM_DRAW  UsageHint = 0x88E0 // Modify once, use seldom.
	STATIC_DRAW  UsageHint = 0x88E4 // Modify once, use often.
	DYNAMIC_DRAW UsageHint = 0x88E8 // Modify often, use often.
)

type VertexArray

type VertexArray uint32

A Vertex Array object stores the state that describes arrays of vertex data that will be used in rendering commands.

func GenVertexArrays

func GenVertexArrays(n int) []VertexArray

GenVertexArrays returns a slice of n vertex array object names. https://www.opengl.org/sdk/docs/man3/xhtml/glGenVertexArrays.xml

type WindingOrder

type WindingOrder uint
const (
	CW  WindingOrder = 0x0900 // Clockwise
	CCW WindingOrder = 0x0901 // Counter-clockwise
)

Notes

Bugs

  • This library is still in an experimental state. The API is subject to change.

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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