Documentation ¶
Index ¶
- Constants
- type AttributePointer
- type Command
- type FrameBuffer
- func (f *FrameBuffer) AttachTexture(attachment uint32, texture *Texture) error
- func (f *FrameBuffer) Bind()
- func (f *FrameBuffer) BindForDraw()
- func (f *FrameBuffer) BindForRead()
- func (f *FrameBuffer) Destroy()
- func (f *FrameBuffer) Resize(width uint32, height uint32)
- func (f *FrameBuffer) SetDrawBuffers(buffers []uint32)
- func (f *FrameBuffer) Texture(attachment uint32) (*Texture, bool)
- func (f *FrameBuffer) Unbind()
- func (f *FrameBuffer) UnbindForDraw()
- func (f *FrameBuffer) UnbindForRead()
- type IndexBuffer
- func (i *IndexBuffer) Bind()
- func (i *IndexBuffer) BufferUint16(data []uint16)
- func (i *IndexBuffer) BufferUint32(data []uint32)
- func (i *IndexBuffer) BufferUint8(data []uint8)
- func (i *IndexBuffer) Destroy()
- func (i *IndexBuffer) Draw(mode uint32, count int32, typ uint32, byteOffset int)
- func (i *IndexBuffer) DrawInstanced(mode uint32, count int32, typ uint32, byteOffset int, primcount int32)
- func (i *IndexBuffer) Unbind()
- type Renderable
- func (r *Renderable) Bind()
- func (r *Renderable) Destroy()
- func (r *Renderable) Draw()
- func (r *Renderable) SetDrawArrays(mode uint32, first int32, count int32)
- func (r *Renderable) SetDrawArraysInstanced(mode uint32, first int32, count int32, primcount int32)
- func (r *Renderable) SetDrawElements(mode uint32, count int32, typ uint32, byteOffset int)
- func (r *Renderable) SetDrawElementsInstanced(mode uint32, count int32, typ uint32, byteOffset int, primcount int32)
- func (r *Renderable) SetIndexBuffer(ib *IndexBuffer)
- func (r *Renderable) SetInstancedAttributes(instancedIndices []uint32)
- func (r *Renderable) SetPointer(index uint32, pointer *AttributePointer)
- func (r *Renderable) SetVertexBuffer(vb *VertexBuffer)
- func (r *Renderable) Unbind()
- func (r *Renderable) Upload()
- type Shader
- func (s *Shader) AttachShader(shader uint32)
- func (s *Shader) CreateShader(source string, typ uint32) (uint32, error)
- func (s *Shader) Destroy()
- func (s *Shader) LinkProgram() error
- func (s *Shader) SetUniform(name string, arg interface{}) error
- func (s *Shader) SetUniform1f(location int32, arg interface{}) error
- func (s *Shader) SetUniform1fv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniform1i(location int32, arg interface{}) error
- func (s *Shader) SetUniform1iv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniform1ui(location int32, arg interface{}) error
- func (s *Shader) SetUniform1uiv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniform2fv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniform3fv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniform4fv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniformMatrix3fv(location int32, count int32, arg interface{}) error
- func (s *Shader) SetUniformMatrix4fv(location int32, count int32, arg interface{}) error
- func (s *Shader) UniformBlockDescriptors() map[string]*UniformBlockDescriptor
- func (s *Shader) UniformDescriptors() map[string]*UniformDescriptor
- func (s *Shader) Use()
- type Technique
- func (t *Technique) BlendFunc(sfactor uint32, dfactor uint32)
- func (t *Technique) ClearColor(r, g, b, a float32)
- func (t *Technique) CullFace(mode uint32)
- func (t *Technique) DepthFunc(xfunc uint32)
- func (t *Technique) DepthMask(flag bool)
- func (t *Technique) Draw(commands []*Command) error
- func (t *Technique) Enable(enable uint32)
- func (t *Technique) Shader(shader *Shader)
- func (t *Technique) Viewport(viewport *Viewport)
- type Texture
- type TextureParams
- type UniformBlockDescriptor
- type UniformDescriptor
- type VertexBuffer
- func (v *VertexBuffer) AllocateBuffer(numBytes int)
- func (v *VertexBuffer) Bind()
- func (v *VertexBuffer) BufferFloat32(data []float32)
- func (v *VertexBuffer) BufferSubFloat32(data []float32, offset int)
- func (v *VertexBuffer) Destroy()
- func (v *VertexBuffer) Draw(mode uint32, first int32, count int32)
- func (v *VertexBuffer) DrawInstanced(mode uint32, first int32, count int32, primcount int32)
- func (v *VertexBuffer) Unbind()
- type Viewport
Constants ¶
const ( // DefaultWrapS is the default wrap S parameter. DefaultWrapS = gl.CLAMP_TO_EDGE // DefaultWrapT is the default wrap T parameter. DefaultWrapT = gl.CLAMP_TO_EDGE // DefaultMinFilter is the default min filter parameter. DefaultMinFilter = gl.NEAREST // DefaultMagFilter is the default mag filter parameter. DefaultMagFilter = gl.NEAREST )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributePointer ¶
type AttributePointer struct { Index uint32 Size int32 Type uint32 ByteStride int32 ByteOffset int }
AttributePointer represents a vertex attribute pointer.
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command represents a render command.
func (*Command) Renderable ¶
func (c *Command) Renderable(renderable *Renderable)
Renderable sets a renderable to be drawn.
type FrameBuffer ¶
type FrameBuffer struct {
// contains filtered or unexported fields
}
FrameBuffer represents a framebuffer object
func NewFrameBuffer ¶
func NewFrameBuffer() *FrameBuffer
NewFrameBuffer instantiates and returns a new framebuffer instance.
func (*FrameBuffer) AttachTexture ¶
func (f *FrameBuffer) AttachTexture(attachment uint32, texture *Texture) error
AttachTexture attaches the provided texture to the provided attachment id.
func (*FrameBuffer) BindForDraw ¶
func (f *FrameBuffer) BindForDraw()
BindForDraw binds the framebuffer object for drawing.
func (*FrameBuffer) BindForRead ¶
func (f *FrameBuffer) BindForRead()
BindForRead binds the framebuffer object for reading.
func (*FrameBuffer) Destroy ¶
func (f *FrameBuffer) Destroy()
Destroy deallocates the framebuffer object.
func (*FrameBuffer) Resize ¶
func (f *FrameBuffer) Resize(width uint32, height uint32)
Resize will resize all attached textures.
func (*FrameBuffer) SetDrawBuffers ¶
func (f *FrameBuffer) SetDrawBuffers(buffers []uint32)
SetDrawBuffers sets the draw buffers for the framebuffer object.
func (*FrameBuffer) Texture ¶
func (f *FrameBuffer) Texture(attachment uint32) (*Texture, bool)
Texture returns the texture for the provided attachment id.
func (*FrameBuffer) UnbindForDraw ¶
func (f *FrameBuffer) UnbindForDraw()
UnbindForDraw unbinds the framebuffer object for drawing.
func (*FrameBuffer) UnbindForRead ¶
func (f *FrameBuffer) UnbindForRead()
UnbindForRead unbinds the framebuffer object for reading.
type IndexBuffer ¶
type IndexBuffer struct {
// contains filtered or unexported fields
}
IndexBuffer represents an indexbuffer.
func (*IndexBuffer) BufferUint16 ¶
func (i *IndexBuffer) BufferUint16(data []uint16)
BufferUint16 allocates uint16 buffer data.
func (*IndexBuffer) BufferUint32 ¶
func (i *IndexBuffer) BufferUint32(data []uint32)
BufferUint32 allocates uint32 buffer data.
func (*IndexBuffer) BufferUint8 ¶
func (i *IndexBuffer) BufferUint8(data []uint8)
BufferUint8 allocates uint8 buffer data.
func (*IndexBuffer) Draw ¶
func (i *IndexBuffer) Draw(mode uint32, count int32, typ uint32, byteOffset int)
Draw renders the indexbuffer.
func (*IndexBuffer) DrawInstanced ¶
func (i *IndexBuffer) DrawInstanced(mode uint32, count int32, typ uint32, byteOffset int, primcount int32)
DrawInstanced renders multiple instances of the indexbuffer.
type Renderable ¶
type Renderable struct {
// contains filtered or unexported fields
}
Renderable represents a renderable object.
func (*Renderable) SetDrawArrays ¶
func (r *Renderable) SetDrawArrays(mode uint32, first int32, count int32)
SetDrawArrays sets the params to render the underlying vertexbuffer.
func (*Renderable) SetDrawArraysInstanced ¶
func (r *Renderable) SetDrawArraysInstanced(mode uint32, first int32, count int32, primcount int32)
SetDrawArraysInstanced sets the instancing params to render the underlying vertexbuffer.
func (*Renderable) SetDrawElements ¶
func (r *Renderable) SetDrawElements(mode uint32, count int32, typ uint32, byteOffset int)
SetDrawElements sets the instancing params to render the underlying vertexbuffer.
func (*Renderable) SetDrawElementsInstanced ¶
func (r *Renderable) SetDrawElementsInstanced(mode uint32, count int32, typ uint32, byteOffset int, primcount int32)
SetDrawElementsInstanced sets the params to render the underlying vertexbuffer.
func (*Renderable) SetIndexBuffer ¶
func (r *Renderable) SetIndexBuffer(ib *IndexBuffer)
SetIndexBuffer sets the indexbuffer of the renderable.
func (*Renderable) SetInstancedAttributes ¶
func (r *Renderable) SetInstancedAttributes(instancedIndices []uint32)
SetInstancedAttributes flags provided attributes for instancing.
func (*Renderable) SetPointer ¶
func (r *Renderable) SetPointer(index uint32, pointer *AttributePointer)
SetPointer sets a vertex attribute pointer of the renderable.
func (*Renderable) SetVertexBuffer ¶
func (r *Renderable) SetVertexBuffer(vb *VertexBuffer)
SetVertexBuffer sets the vertexbuffer of the renderable.
func (*Renderable) Upload ¶
func (r *Renderable) Upload()
Upload allocates the renderable to the GPU.
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
Shader represents a shader program.
func NewVertFragShader ¶
NewVertFragShader instantiates a new shader object.
func (*Shader) AttachShader ¶
AttachShader attaches a shader object to the program.
func (*Shader) CreateShader ¶
CreateShader creates an individual shader object.
func (*Shader) LinkProgram ¶
LinkProgram links the shader program.
func (*Shader) SetUniform ¶
SetUniform buffers one or more uniforms.
func (*Shader) SetUniform1f ¶
SetUniform1f buffers a float32 by value.
func (*Shader) SetUniform1fv ¶
SetUniform1fv buffers one or more float32 by address.
func (*Shader) SetUniform1i ¶
SetUniform1i buffers a int32 by value.
func (*Shader) SetUniform1iv ¶
SetUniform1iv buffers one or more int32 by address.
func (*Shader) SetUniform1ui ¶
SetUniform1ui buffers an uint32 by value.
func (*Shader) SetUniform1uiv ¶
SetUniform1uiv buffers one or more uint32 by address.
func (*Shader) SetUniform2fv ¶
SetUniform2fv buffers one or more 2-component float32 by address.
func (*Shader) SetUniform3fv ¶
SetUniform3fv buffers one or more 3-component float32 by address.
func (*Shader) SetUniform4fv ¶
SetUniform4fv buffers one or more 4-component float32 by address.
func (*Shader) SetUniformMatrix3fv ¶
SetUniformMatrix3fv buffers one or more 9-component float32 by address.
func (*Shader) SetUniformMatrix4fv ¶
SetUniformMatrix4fv buffers one or more 16-component float32 by address.
func (*Shader) UniformBlockDescriptors ¶
func (s *Shader) UniformBlockDescriptors() map[string]*UniformBlockDescriptor
UniformBlockDescriptors returns the map of uniform block descriptors.
func (*Shader) UniformDescriptors ¶
func (s *Shader) UniformDescriptors() map[string]*UniformDescriptor
UniformDescriptors returns the map of uniform descriptors.
type Technique ¶
type Technique struct {
// contains filtered or unexported fields
}
Technique represents a render technique.
func NewTechnique ¶
func NewTechnique() *Technique
NewTechnique instantiates and returns a new technique instance.
func (*Technique) ClearColor ¶
ClearColor sets the clear color for the frame.
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture represents a 2D texture object.
func LoadRGBATexture ¶
LoadRGBATexture loads an image file into an RGBA texture.
func NewRGBATexture ¶
func NewRGBATexture(rgba []uint8, width uint32, height uint32, params *TextureParams) *Texture
NewRGBATexture returns a new RGBA texture.
type TextureParams ¶
TextureParams represents parameters for a 2D texture object.
type UniformBlockDescriptor ¶
type UniformBlockDescriptor struct { Name string Index uint32 Size int32 Offsets map[string]int32 Alignment int32 }
UniformBlockDescriptor represents a shader uniform blocks attributes.
func (*UniformBlockDescriptor) AlignedSize ¶
func (u *UniformBlockDescriptor) AlignedSize() int32
AlignedSize returns the aligned block size of the uniform block.
func (*UniformBlockDescriptor) Offset ¶
func (u *UniformBlockDescriptor) Offset(name string) (int32, error)
Offset returns the offset of the uniform block.
func (*UniformBlockDescriptor) UnAlignedSize ¶
func (u *UniformBlockDescriptor) UnAlignedSize() int32
UnAlignedSize returns the unaligned block size of the uniform block.
type UniformDescriptor ¶
UniformDescriptor represents a single shader uniforms attributes.
type VertexBuffer ¶
type VertexBuffer struct {
// contains filtered or unexported fields
}
VertexBuffer represents a vertexbuffer.
func (*VertexBuffer) AllocateBuffer ¶
func (v *VertexBuffer) AllocateBuffer(numBytes int)
AllocateBuffer allocates the size of the underlying buffer.
func (*VertexBuffer) BufferFloat32 ¶
func (v *VertexBuffer) BufferFloat32(data []float32)
BufferFloat32 buffers a float32 slice.
func (*VertexBuffer) BufferSubFloat32 ¶
func (v *VertexBuffer) BufferSubFloat32(data []float32, offset int)
BufferSubFloat32 buffers a float32 slice into a portion of the underlying buffer.
func (*VertexBuffer) Destroy ¶
func (v *VertexBuffer) Destroy()
Destroy deallocates the vertexbuffer.
func (*VertexBuffer) Draw ¶
func (v *VertexBuffer) Draw(mode uint32, first int32, count int32)
Draw renders the vertexbuffer.
func (*VertexBuffer) DrawInstanced ¶
func (v *VertexBuffer) DrawInstanced(mode uint32, first int32, count int32, primcount int32)
DrawInstanced renders multiple instances of the vertexbuffer.