Documentation
¶
Overview ¶
Package gfx is a thin abstraction layer for OpenGL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AtInit []func()
AtInit is a slice of functions called at graphics context initialization.
var GL gl.Context
GL is the OpenGL context.
Functions ¶
func AddInit ¶
func AddInit(f func()) struct{}
AddInit appends a function to AtInit and returns an empty struct.
func Init ¶
Init is an internal function that sets up the context and then calls the functions in AtInit.
func MustShader ¶
MustShader compiles a shader or panics.
Types ¶
type Camera ¶
type Camera struct { Offset Matrix Rotation Matrix Position Matrix Perspective Matrix // contains filtered or unexported fields }
Camera tracks the position and orientation of the 3D camera.
func (*Camera) PopTransform ¶
func (c *Camera) PopTransform()
PopTransform removes the last transform added via PushTransform.
func (*Camera) PushTransform ¶
PushTransform adds a transform to the transform stack.
func (*Camera) SetDefaults ¶
func (c *Camera) SetDefaults()
SetDefaults sets the Matrix fields in Camera to default values.
type Matrix ¶
type Matrix [16]float32
Matrix is a 4x4 transformation matrix.
func MultiplyMatrix ¶
MultiplyMatrix multiplies a matrix by a matrix.
func Perspective ¶
Perspective constructs a perspective matrix.
func Translation ¶
Translation constructs translation matrix.
type StaticBuffer ¶
StaticBuffer is a convenience layer for OpenGL vertex buffer objects.
var ( // Square is a StaticBuffer containing vertices for a square. Square *StaticBuffer )
func NewStaticBuffer ¶
func NewStaticBuffer(data []uint8, elements []uint16) *StaticBuffer
NewStaticBuffer creates a StaticBuffer.
func (*StaticBuffer) Delete ¶
func (sb *StaticBuffer) Delete()
Delete frees the resources held by the StaticBuffer.