Documentation
¶
Overview ¶
Package gfx is a thin abstraction layer for OpenGL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // FrameSync is an internal variable. FrameSync = make(chan chan struct{}, 1) )
var GL gl.Context
GL is the OpenGL context.
var Lock sync.Mutex
Lock should be held whenever an operation depends on or modifies global OpenGL state.
var Square = NewStaticBuffer("square", []uint8{ m1, +1, m1, 1, 0, 0, m1, m1, m1, 1, 0, 1, +1, m1, +1, 1, 1, 1, +1, +1, +1, 1, 1, 0, }, []uint16{3, 2, 1, 0, 3, 1})
Square is a StaticBuffer containing vertices for a square.
Functions ¶
Types ¶
type AssetTexture ¶ added in v0.2.72
type AssetTexture struct { Name string // contains filtered or unexported fields }
AssetTexture is a lazy-loaded texture.
func BlankAssetTexture ¶ added in v0.2.75
func BlankAssetTexture() *AssetTexture
BlankAssetTexture returns a 1x1 white square.
func NewAssetTexture ¶ added in v0.2.72
func NewAssetTexture(name string, nearest bool) *AssetTexture
NewAssetTexture creates a lazy-loaded texture from an asset.
func NewCachedAssetTexture ¶ added in v0.2.75
func NewCachedAssetTexture(name string) *AssetTexture
NewCachedAssetTexture creates a lazy-loaded texture from an asset.
func NewEmbeddedTexture ¶ added in v0.2.75
NewEmbeddedTexture creates an AssetTexture that loads from memory.
func (*AssetTexture) LazyTexture ¶ added in v0.2.73
func (a *AssetTexture) LazyTexture(def gl.Texture) gl.Texture
LazyTexture loads the texture and returns the texture handle.
func (*AssetTexture) Preload ¶ added in v0.2.72
func (a *AssetTexture) Preload() error
Preload loads the texture and returns any error encountered.
func (*AssetTexture) Release ¶ added in v0.2.73
func (a *AssetTexture) Release()
Release deletes the texture handle.
func (*AssetTexture) Texture ¶ added in v0.2.72
func (a *AssetTexture) Texture() gl.Texture
Texture loads the texture and returns the texture handle.
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 CustomInit ¶ added in v0.2.70
type CustomInit struct { Name string // contains filtered or unexported fields }
CustomInit is a custom OpenGL init/release function pair.
func Custom ¶ added in v0.2.70
func Custom(name string, init, release func()) *CustomInit
Custom registers a CustomInit.
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 Program ¶ added in v0.2.70
Program is an OpenGL shader.
type StaticBuffer ¶
type StaticBuffer struct { Name string Data gl.Buffer Element gl.Buffer Count int // contains filtered or unexported fields }
StaticBuffer is a convenience layer for OpenGL vertex buffer objects.
func NewStaticBuffer ¶
func NewStaticBuffer(name string, data []uint8, elements []uint16) *StaticBuffer
NewStaticBuffer creates a StaticBuffer.
func (*StaticBuffer) Delete ¶
func (sb *StaticBuffer) Delete()
Delete frees the GPU memory held by StaticBuffer and removes it from the list of buffers.
type Texture ¶ added in v0.2.70
Texture is an OpenGL texture.
func NewTexture ¶ added in v0.2.70
NewTexture creates a texture.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package crt renders a screen-space CRT monitor effect.
|
Package crt renders a screen-space CRT monitor effect. |
Package sprites handles loading and rendering sprites.
|
Package sprites handles loading and rendering sprites. |