Documentation ¶
Overview ¶
Package gl provides simple abstractions over a modern subset of OpenGL.
Index ¶
- Variables
- func BindComputeSubroutines(s []uint32)
- func BindFragmentSubroutines(s []uint32)
- func BindGeometrySubroutines(s []uint32)
- func BindTessControlSubroutines(s []uint32)
- func BindTessEvaluationSubroutines(s []uint32)
- func BindVertexSubroutines(s []uint32)
- func Blending(src, dst BlendFactor)
- func ClearColorBuffer(c struct{ ... })
- func ClearDepthBuffer(d float32)
- func ClearStencilBuffer(m int32)
- func DepthRange(near, far float64)
- func Disable(c Capability)
- func Draw(first int32, count int32)
- func DrawIndexed(first int32, count int32)
- func DrawIndirect(firstdraw uintptr, drawcount int32)
- func DrawInstanced(first int32, count int32, instances int32)
- func Enable(c Capability)
- func Err() error
- func PointSize(s float32)
- func Setup(dbg bool) error
- func Viewport(ox, oy, width, height int32)
- type BlendFactor
- type BufferFlags
- type BufferMask
- type BufferTexture
- type Capability
- type ComparisonOp
- type DrawIndirectCommand
- type FilterMode
- type Framebuffer
- type FramebufferAttachment
- type FramebufferTarget
- type IndexBuffer
- type IndirectBuffer
- type Pipeline
- type PipelineConfig
- func ComputeShader(r io.Reader) PipelineConfig
- func CullFace(front, back bool) PipelineConfig
- func DepthClamp(enable bool) PipelineConfig
- func DepthComparison(op ComparisonOp) PipelineConfig
- func DepthTest(enable bool) PipelineConfig
- func FragmentShader(r io.Reader) PipelineConfig
- func FrontFace(d WindingDirection) PipelineConfig
- func GeometryShader(r io.Reader) PipelineConfig
- func PrimitiveRestart(enable bool) PipelineConfig
- func RasterizerDiscard(enable bool) PipelineConfig
- func Shader(path string) PipelineConfig
- func ShareShadersWith(other *Pipeline) PipelineConfig
- func ShareVertexFormatsWith(other *Pipeline) PipelineConfig
- func StencilTest(enable bool) PipelineConfig
- func TessControlShader(r io.Reader) PipelineConfig
- func TessEvaluationShader(r io.Reader) PipelineConfig
- func Topology(m Primitive) PipelineConfig
- func VertexFormat(binding uint32, format interface{}) PipelineConfig
- func VertexShader(r io.Reader) PipelineConfig
- type Primitive
- type Sampler
- type SamplerOption
- func Anisotropy(max float32) SamplerOption
- func BorderColor(color struct{ ... }) SamplerOption
- func Comparison(op ComparisonOp) SamplerOption
- func LevelOfDetail(min, max float32) SamplerOption
- func Magnification(fm FilterMode) SamplerOption
- func Minification(fm FilterMode) SamplerOption
- func Wrapping(s, t, p WrapMode) SamplerOption
- type StorageBuffer
- type Texture1D
- type Texture2D
- type Texture3D
- type TextureArray1D
- type TextureArray2D
- type TextureFormat
- type UniformBuffer
- type VertexBuffer
- type WindingDirection
- type WrapMode
Constants ¶
This section is empty.
Variables ¶
var DefaultFramebuffer = Framebuffer{ // contains filtered or unexported fields }
Functions ¶
func BindComputeSubroutines ¶
func BindComputeSubroutines(s []uint32)
BindComputeSubroutines binds the compute shader subroutines to indices in s.
func BindFragmentSubroutines ¶
func BindFragmentSubroutines(s []uint32)
BindFragmentSubroutines binds the fragment shader subroutines to indices in s.
func BindGeometrySubroutines ¶
func BindGeometrySubroutines(s []uint32)
BindGeometrySubroutines binds the geometry shader subroutines to indices in s.
func BindTessControlSubroutines ¶
func BindTessControlSubroutines(s []uint32)
BindTessControlSubroutines binds the tesselation control shader subroutines to indices in s.
func BindTessEvaluationSubroutines ¶
func BindTessEvaluationSubroutines(s []uint32)
BindTessEvaluationSubroutines binds the tesselation evaluation shader subroutines to indices in s.
func BindVertexSubroutines ¶
func BindVertexSubroutines(s []uint32)
BindVertexSubroutines binds the vertex shader subroutines to indices in s.
func Blending ¶
func Blending(src, dst BlendFactor)
Blending specifies the formula used for blending pixels.
Note that you must also `Enable(Blend)`. The default values are `One` and `Zero`. For alpha-blending and antialiasing, the most useful choice is `Blending(SrcAlpha, OneMinusSrcAlpha)`.
func ClearColorBuffer ¶
func ClearColorBuffer(c struct{ R, G, B, A float32 })
ClearColorBuffer clears the color buffer with c.
func ClearDepthBuffer ¶
func ClearDepthBuffer(d float32)
ClearDepthBuffer clears the depth buffer with d.
func ClearStencilBuffer ¶
func ClearStencilBuffer(m int32)
ClearStencilBuffer clears the stencil buffer with m.
func DepthRange ¶
func DepthRange(near, far float64)
DepthRange specifies the mapping of depth values from normalized device coordinates to window coordinates.
func DrawIndexed ¶
DrawIndexed asks the GPU to draw a sequence of primitives with indexed vertices.
func DrawIndirect ¶
DrawIndirect asks the GPU to read the Indirect Buffer starting at firstdraw, and make drawcount draw calls.
func DrawInstanced ¶
DrawInstanced asks the GPU to draw several instances of a sequence of primitives.
Types ¶
type BlendFactor ¶
A BlendFactor is a formula used when blending pixels.
const ( Zero BlendFactor = C.GL_ZERO One BlendFactor = C.GL_ONE SrcColor BlendFactor = C.GL_SRC_COLOR OneMinusSrcColor BlendFactor = C.GL_ONE_MINUS_SRC_COLOR DstColor BlendFactor = C.GL_DST_COLOR OneMinusDstColor BlendFactor = C.GL_ONE_MINUS_DST_COLOR SrcAlpha BlendFactor = C.GL_SRC_ALPHA OneMinusSrcAlpha BlendFactor = C.GL_ONE_MINUS_SRC_ALPHA DstAlpha BlendFactor = C.GL_DST_ALPHA OneMinusDstAlpha BlendFactor = C.GL_ONE_MINUS_DST_ALPHA ConstantColor BlendFactor = C.GL_CONSTANT_COLOR OneMinusConstantColor BlendFactor = C.GL_ONE_MINUS_CONSTANT_COLOR ConstantAlpha BlendFactor = C.GL_CONSTANT_ALPHA OneMinusConstantAlpha BlendFactor = C.GL_ONE_MINUS_CONSTANT_ALPHA AlphaSaturate BlendFactor = C.GL_SRC_ALPHA_SATURATE Src1Color BlendFactor = C.GL_SRC1_COLOR OneMinusSrc1Color BlendFactor = C.GL_ONE_MINUS_SRC1_COLOR Src1Alpha BlendFactor = C.GL_SRC1_ALPHA OneMinuxSrc1Alpha BlendFactor = C.GL_ONE_MINUS_SRC1_ALPHA )
Used in `Blending`.
type BufferFlags ¶
type BufferFlags C.GLbitfield
BufferFlags specifiy which settings to use when creating a new buffer. Values can be ORed together.
const ( StaticStorage BufferFlags = C.GL_NONE // Content will not be updated MapRead BufferFlags = C.GL_MAP_READ_BIT // Data store will be mapped for reading MapWrite BufferFlags = C.GL_MAP_WRITE_BIT // Data store will be mapped for writing MapPersistent BufferFlags = C.GL_MAP_PERSISTENT_BIT // Data store will be accessed by both application and GPU while mapped MapCoherent BufferFlags = C.GL_MAP_COHERENT_BIT // No synchronization needed when persistently mapped DynamicStorage BufferFlags = C.GL_DYNAMIC_STORAGE_BIT // Content will be updated ClientStorage BufferFlags = C.GL_CLIENT_STORAGE_BIT // Prefer storage on application side )
Used in `NewUniformBuffer` and `NewVertexBuffer`.
type BufferMask ¶
type BufferMask C.GLbitfield
const ( ColorBufferBit BufferMask = C.GL_COLOR_BUFFER_BIT DepthBufferBit BufferMask = C.GL_DEPTH_BUFFER_BIT StencilBufferBit BufferMask = C.GL_STENCIL_BUFFER_BIT )
type BufferTexture ¶
type BufferTexture struct {
// contains filtered or unexported fields
}
func NewBufferTexture ¶
func NewBufferTexture(data interface{}, fmt TextureFormat, f BufferFlags) BufferTexture
type Capability ¶
A Capability is an OpenGL functionality that can be enabled or disabled.
const ( Blend Capability = C.GL_BLEND ColorLogicOp Capability = C.GL_COLOR_LOGIC_OP DebugOutput Capability = C.GL_DEBUG_OUTPUT DebugOutputSynchronous Capability = C.GL_DEBUG_OUTPUT_SYNCHRONOUS Dither Capability = C.GL_DITHER FramebufferSRGB Capability = C.GL_FRAMEBUFFER_SRGB LineSmooth Capability = C.GL_LINE_SMOOTH Multisample Capability = C.GL_MULTISAMPLE SampleAlphaToCoverage Capability = C.GL_SAMPLE_ALPHA_TO_COVERAGE SampleAlphaToOne Capability = C.GL_SAMPLE_ALPHA_TO_ONE SampleCoverage Capability = C.GL_SAMPLE_COVERAGE SampleShading Capability = C.GL_SAMPLE_SHADING SampleMask Capability = C.GL_SAMPLE_MASK ScissorTest Capability = C.GL_SCISSOR_TEST TextureCubeMapSeamless Capability = C.GL_TEXTURE_CUBE_MAP_SEAMLESS )
Used in `Enable` and `Disable`.
type ComparisonOp ¶
A ComparisonOp specifies an operator for depth texture comparison.
const ( LessOrEqual ComparisonOp = C.GL_LEQUAL GreaterOrEqual ComparisonOp = C.GL_GEQUAL Less ComparisonOp = C.GL_LESS Greater ComparisonOp = C.GL_GREATER Equal ComparisonOp = C.GL_EQUAL NotEqual ComparisonOp = C.GL_NOTEQUAL Always ComparisonOp = C.GL_ALWAYS Never ComparisonOp = C.GL_NEVER )
Used in `Sampler.Comparison` and `DepthComparison`.
type DrawIndirectCommand ¶
type DrawIndirectCommand struct { VertexCount uint32 InstanceCount uint32 FirstVertex uint32 BaseInstance uint32 }
A DrawIndirectCommand describes a single draw call. A slice of these is used to fill indirect buffers.
type FilterMode ¶
A FilterMode specifies how to filter textures when minifying or magnifying.
const ( Nearest FilterMode = C.GL_NEAREST Linear FilterMode = C.GL_LINEAR NearestMimapNearest FilterMode = C.GL_NEAREST_MIPMAP_NEAREST LinearMipmapNearest FilterMode = C.GL_LINEAR_MIPMAP_NEAREST NearestMipmapLinear FilterMode = C.GL_NEAREST_MIPMAP_LINEAR LinearMipmapLinear FilterMode = C.GL_LINEAR_MIPMAP_LINEAR )
Used in `Sampler.Minification` and `Sampler.Magnification` (only `Nearest` and `Linear` are valid for magnification).
type Framebuffer ¶
type Framebuffer struct {
// contains filtered or unexported fields
}
func NewFramebuffer ¶
func NewFramebuffer() Framebuffer
func (Framebuffer) Bind ¶
func (fb Framebuffer) Bind(t FramebufferTarget)
func (Framebuffer) Blit ¶
func (fb Framebuffer) Blit(dst Framebuffer, srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2 int32, m BufferMask, f FilterMode)
func (Framebuffer) DrawBuffer ¶
func (fb Framebuffer) DrawBuffer(a FramebufferAttachment)
func (Framebuffer) Texture ¶
func (fb Framebuffer) Texture(a FramebufferAttachment, t Texture2D, level int32)
type FramebufferAttachment ¶
const ( ColorAttachment0 FramebufferAttachment = C.GL_COLOR_ATTACHMENT0 ColorAttachment1 FramebufferAttachment = C.GL_COLOR_ATTACHMENT1 ColorAttachment2 FramebufferAttachment = C.GL_COLOR_ATTACHMENT2 ColorAttachment3 FramebufferAttachment = C.GL_COLOR_ATTACHMENT3 DepthAttachment FramebufferAttachment = C.GL_DEPTH_ATTACHMENT StencilAttachment FramebufferAttachment = C.GL_STENCIL_ATTACHMENT DepthStencilAttachment FramebufferAttachment = C.GL_DEPTH_STENCIL_ATTACHMENT )
type FramebufferTarget ¶
const ( DrawFramebuffer FramebufferTarget = C.GL_DRAW_FRAMEBUFFER ReadFramebuffer FramebufferTarget = C.GL_READ_FRAMEBUFFER DrawReadFramebuffer FramebufferTarget = C.GL_FRAMEBUFFER )
type IndexBuffer ¶
type IndexBuffer struct {
// contains filtered or unexported fields
}
An IndexBuffer is a block of memory owned by the GPU, used to store vertex indices.
func NewIndexBuffer ¶
func NewIndexBuffer(data interface{}, f BufferFlags) IndexBuffer
NewIndexBuffer asks the GPU to allocate a new block of memory.
If data is a uinptr, it is interpreted as the desired size for the buffer (in bytes), and the content is not initialized. Otherwise data must be a slice of uint8, uint16 or uin32. In all cases the size of the buffer is fixed at creation.
func (*IndexBuffer) SubData ¶
func (eb *IndexBuffer) SubData(data interface{}, atOffset uintptr)
SubData updates the buffer with data, starting at a specified offset.
It is your responsability to ensure that the size of data plus the offset does not exceed the buffer size.
type IndirectBuffer ¶
type IndirectBuffer struct {
// contains filtered or unexported fields
}
An IndirectBuffer is a block of memory owned by the GPU.
func NewIndirectBuffer ¶
func NewIndirectBuffer(data interface{}, f BufferFlags) IndirectBuffer
NewIndirectBuffer asks the GPU to allocate a new block of memory.
If data is a ¶
In all cases the size of the buffer is fixed at creation.
func (*IndirectBuffer) Bind ¶
func (ib *IndirectBuffer) Bind()
Bind the indirect buffer.
The buffer should use the same struct type than the one used in the corresponding call to Pipeline.IndirectFormat.
func (*IndirectBuffer) SubData ¶
func (ib *IndirectBuffer) SubData(data interface{}, atOffset uintptr)
SubData updates the buffer with data, starting at a specified offset.
It is your responsability to ensure that the size of data plus the offset does not exceed the buffer size.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
A Pipeline consists of shaders and state for the GPU.
func NewPipeline ¶
func NewPipeline(o ...PipelineConfig) *Pipeline
NewPipeline returns a pipeline with created from a specific set of shaders.
type PipelineConfig ¶
type PipelineConfig func(*Pipeline)
A PipelineConfig represents a configuration option used when creating a new pipeline.
func ComputeShader ¶
func ComputeShader(r io.Reader) PipelineConfig
ComputeShader compiles a comput shader.
func CullFace ¶
func CullFace(front, back bool) PipelineConfig
CullFace specifies if front and/or back faces are culled.
See also `FrontFace`.
func DepthClamp ¶
func DepthClamp(enable bool) PipelineConfig
func DepthComparison ¶
func DepthComparison(op ComparisonOp) PipelineConfig
DepthComparison specifies the function used to compare pixel depth.
Note that you must also `Enable(DepthTest)`. The default value is `Less`.
func DepthTest ¶
func DepthTest(enable bool) PipelineConfig
func FragmentShader ¶
func FragmentShader(r io.Reader) PipelineConfig
FragmentShader compiles a fragment shader.
func FrontFace ¶
func FrontFace(d WindingDirection) PipelineConfig
FrontFace specifies which winding direction is considered front.
See also `CullFace`.
func GeometryShader ¶
func GeometryShader(r io.Reader) PipelineConfig
GeometryShader compiles a geometry shader.
func PrimitiveRestart ¶
func PrimitiveRestart(enable bool) PipelineConfig
func RasterizerDiscard ¶
func RasterizerDiscard(enable bool) PipelineConfig
func Shader ¶
func Shader(path string) PipelineConfig
Shader compiles a shader. The path is slash-separated, and the file extension determine the type of shader:
- ".vert" for a vertex shader - ".frag" for a fragment shader - ".comp" for a compute shader - ".geom" for a geometry shader - ".tesc" for a tesselation control shader - ".tese" for a tesselation evaluation shader
func ShareShadersWith ¶
func ShareShadersWith(other *Pipeline) PipelineConfig
func ShareVertexFormatsWith ¶
func ShareVertexFormatsWith(other *Pipeline) PipelineConfig
func StencilTest ¶
func StencilTest(enable bool) PipelineConfig
func TessControlShader ¶
func TessControlShader(r io.Reader) PipelineConfig
TessControlShader compiles a tesselation control shader.
func TessEvaluationShader ¶
func TessEvaluationShader(r io.Reader) PipelineConfig
TessEvaluationShader compiles a tesselation evaluation shader.
func Topology ¶
func Topology(m Primitive) PipelineConfig
func VertexFormat ¶
func VertexFormat(binding uint32, format interface{}) PipelineConfig
VertexFormat prepares everything the pipeline needs to use a vertex buffer of a specific format, and assign a binding index to it.
The format must be a slice of struct, and the struct must have with layout tags.
func VertexShader ¶
func VertexShader(r io.Reader) PipelineConfig
VertexShader compiles a vertex shader.
type Primitive ¶
A Primitive specifies what kind of object to draw.
const ( Points Primitive = C.GL_POINTS Lines Primitive = C.GL_LINES LineLoop Primitive = C.GL_LINE_LOOP LineStrip Primitive = C.GL_LINE_STRIP Triangles Primitive = C.GL_TRIANGLES TriangleStrip Primitive = C.GL_TRIANGLE_STRIP TriangleFan Primitive = C.GL_TRIANGLE_FAN LinesAdjency Primitive = C.GL_LINES_ADJACENCY LineStripAdjency Primitive = C.GL_LINE_STRIP_ADJACENCY TrianglesAdjency Primitive = C.GL_TRIANGLES_ADJACENCY TriangleStripAdjency Primitive = C.GL_TRIANGLE_STRIP_ADJACENCY Patches Primitive = C.GL_PATCHES )
Used in `Topology`.
type Sampler ¶
type Sampler struct {
// contains filtered or unexported fields
}
A Sampler describes a way to sample textures inside shaders.
type SamplerOption ¶
type SamplerOption func(sa *Sampler)
A SamplerOption is a setting used when creating a new `Sampler`.
func Anisotropy ¶
func Anisotropy(max float32) SamplerOption
Anisotropy specifies the maximum anisotropy level.
func BorderColor ¶
func BorderColor(color struct{ R, G, B, A float32 }) SamplerOption
BorderColor sets the color used for texture filtering when ClampToborder wrapping mode is used.
func Comparison ¶
func Comparison(op ComparisonOp) SamplerOption
Comparison specifies the mode and operator used when comparing depth textures.
func LevelOfDetail ¶
func LevelOfDetail(min, max float32) SamplerOption
LevelOfDetail specifies the minimum and maximum LOD to use.
The default values are -1000 and 1000.
func Magnification ¶
func Magnification(fm FilterMode) SamplerOption
Magnification specifies which filter is used when minifying the texture.
The default value is `Linear`.
func Minification ¶
func Minification(fm FilterMode) SamplerOption
Minification specifies which filter is used when minifying the texture.
The default value is `NearestMipmapLinear`.
func Wrapping ¶
func Wrapping(s, t, p WrapMode) SamplerOption
Wrapping sets the wrapping modes for texture coordinates.
The default value is `Repeat` for all coordinates.
type StorageBuffer ¶
type StorageBuffer struct {
// contains filtered or unexported fields
}
A StorageBuffer is a block of memory owned by the GPU.
func NewStorageBuffer ¶
func NewStorageBuffer(data interface{}, f BufferFlags) StorageBuffer
NewStorageBuffer asks the GPU to allocate a new block of memory.
If data is a uinptr, it is interpreted as the desired size for the buffer (in bytes), and the content is not initialized. Otherwise data must be a pointer to a struct of pure values (no nested references). In all cases the size of the buffer is fixed at creation.
func (*StorageBuffer) Bind ¶
func (sb *StorageBuffer) Bind(binding uint32)
Bind to a storage binding index.
This index should correspond to one indicated by a layout qualifier in the shaders.
func (*StorageBuffer) SubData ¶
func (sb *StorageBuffer) SubData(data interface{}, atOffset uintptr)
SubData updates the buffer with data, starting at a specified offset.
It is your responsability to ensure that the size of data plus the offset does not exceed the buffer size.
type Texture1D ¶
type Texture1D struct {
// contains filtered or unexported fields
}
A Texture1D is a one-dimensional texture.
func NewTexture1D ¶
func NewTexture1D(levels int32, f TextureFormat, width int32) Texture1D
NewTexture1D returns a new one-dimensional texture.
func (*Texture1D) GenerateMipmap ¶
func (t *Texture1D) GenerateMipmap()
GenerateMipmap generates mipmaps for the texture.
type Texture2D ¶
type Texture2D struct {
// contains filtered or unexported fields
}
A Texture2D is a two-dimensional texture.
func NewTexture2D ¶
func NewTexture2D(levels int32, f TextureFormat, width, height int32) Texture2D
NewTexture2D returns a new two-dimensional texture.
func (*Texture2D) GenerateMipmap ¶
func (t *Texture2D) GenerateMipmap()
GenerateMipmap generates mipmaps for the texture.
type Texture3D ¶
type Texture3D struct {
// contains filtered or unexported fields
}
A Texture3D is a three-dimensional texture.
func NewTexture3D ¶
func NewTexture3D(levels int32, f TextureFormat, width, height, depth int32) Texture3D
NewTexture3D returns a new three-dimensional texture.
func (*Texture3D) GenerateMipmap ¶
func (t *Texture3D) GenerateMipmap()
GenerateMipmap generates mipmaps for the texture.
type TextureArray1D ¶
type TextureArray1D struct {
// contains filtered or unexported fields
}
A TextureArray1D is an array of one-dimensional textures.
func NewTextureArray1D ¶
func NewTextureArray1D(levels int32, f TextureFormat, width int32, count int32) TextureArray1D
NewTextureArray1D returns a new array of one-dimensional textures.
func (*TextureArray1D) GenerateMipmap ¶
func (t *TextureArray1D) GenerateMipmap()
GenerateMipmap generates mipmaps for the texture.
type TextureArray2D ¶
type TextureArray2D struct {
// contains filtered or unexported fields
}
A TextureArray2D is an array of two-dimensional textures.
func NewTextureArray2D ¶
func NewTextureArray2D(levels int32, f TextureFormat, width, height int32, count int32) TextureArray2D
NewTextureArray2D returns a new array of two-dimensional textures.
func (*TextureArray2D) GenerateMipmap ¶
func (t *TextureArray2D) GenerateMipmap()
GenerateMipmap generates mipmaps for the texture.
type TextureFormat ¶
A TextureFormat specifies the format used to store textures in memory.
const ( R8 TextureFormat = C.GL_R8 R16 TextureFormat = C.GL_R16 R16F TextureFormat = C.GL_R16F R32F TextureFormat = C.GL_R32F R8I TextureFormat = C.GL_R8I R16I TextureFormat = C.GL_R16I R32I TextureFormat = C.GL_R32I R8UI TextureFormat = C.GL_R8UI R16UI TextureFormat = C.GL_R16UI R32UI TextureFormat = C.GL_R32UI RG8 TextureFormat = C.GL_RG8 RG16 TextureFormat = C.GL_RG16 RG16F TextureFormat = C.GL_RG16F RG32F TextureFormat = C.GL_RG32F RG8I TextureFormat = C.GL_RG8I RG16I TextureFormat = C.GL_RG16I RG32I TextureFormat = C.GL_RG32I RG8UI TextureFormat = C.GL_RG8UI RG16UI TextureFormat = C.GL_RG16UI RG32UI TextureFormat = C.GL_RG32UI RGB32F TextureFormat = C.GL_RGB32F RGB32I TextureFormat = C.GL_RGB32I RGB32UI TextureFormat = C.GL_RGB32UI RGB8 TextureFormat = C.GL_RGB8 RGBA8 TextureFormat = C.GL_RGBA8 RGBA16 TextureFormat = C.GL_RGBA16 RGBA16F TextureFormat = C.GL_RGBA16F RGBA32F TextureFormat = C.GL_RGBA32F RGBA8I TextureFormat = C.GL_RGBA8I RGBA16I TextureFormat = C.GL_RGBA16I RGBA32I TextureFormat = C.GL_RGBA32I RGBA8UI TextureFormat = C.GL_RGBA8UI RGBA16UI TextureFormat = C.GL_RGBA16UI RGBA32UI TextureFormat = C.GL_RGBA32UI SRGBA8 TextureFormat = C.GL_SRGB8_ALPHA8 SRGB8 TextureFormat = C.GL_SRGB8 Depth16 TextureFormat = C.GL_DEPTH_COMPONENT16 Depth24 TextureFormat = C.GL_DEPTH_COMPONENT24 Depth32F TextureFormat = C.GL_DEPTH_COMPONENT32F )
Used in NewTexture1D, NewTexture2D...
type UniformBuffer ¶
type UniformBuffer struct {
// contains filtered or unexported fields
}
A UniformBuffer is a block of memory owned by the GPU.
func NewUniformBuffer ¶
func NewUniformBuffer(data interface{}, f BufferFlags) UniformBuffer
NewUniformBuffer asks the GPU to allocate a new block of memory.
If data is a uinptr, it is interpreted as the desired size for the buffer (in bytes), and the content is not initialized. Otherwise data must be a pointer to a struct of pure values (no nested references). In all cases the size of the buffer is fixed at creation.
func (*UniformBuffer) Bind ¶
func (ub *UniformBuffer) Bind(binding uint32)
Bind to a uniform binding index.
This index should correspond to one indicated by a layout qualifier in the shaders.
func (*UniformBuffer) SubData ¶
func (ub *UniformBuffer) SubData(data interface{}, atOffset uintptr)
SubData updates the buffer with data, starting at a specified offset.
It is your responsability to ensure that the size of data plus the offset does not exceed the buffer size.
type VertexBuffer ¶
type VertexBuffer struct {
// contains filtered or unexported fields
}
A VertexBuffer is a block of memory owned by the GPU.
func NewVertexBuffer ¶
func NewVertexBuffer(data interface{}, f BufferFlags) VertexBuffer
NewVertexBuffer asks the GPU to allocate a new block of memory.
If data is a uinptr, it is interpreted as the desired size for the buffer (in bytes), and the content is not initialized. Otherwise data must be a slice of pure values (no nested references). In all cases the size of the buffer is fixed at creation.
func (*VertexBuffer) Bind ¶
func (vb *VertexBuffer) Bind(binding uint32, offset uintptr)
Bind to a vertex buffer binding index.
The buffer should use the same struct type than the one used in the corresponding call to Pipeline.VertexFormat.
func (*VertexBuffer) SubData ¶
func (vb *VertexBuffer) SubData(data interface{}, atOffset uintptr)
SubData updates the buffer with data, starting at a specified offset.
It is your responsability to ensure that the size of data plus the offset does not exceed the buffer size.
type WindingDirection ¶
A WindingDirection specifies a rotation direction.
const ( Clockwise WindingDirection = C.GL_CW CounterClockwise WindingDirection = C.GL_CCW )
Used in `FrontFace`.
type WrapMode ¶
A WrapMode specifies the way a texture wraps.
const ( ClampToBorder WrapMode = C.GL_CLAMP_TO_BORDER ClampToEdge WrapMode = C.GL_CLAMP_TO_EDGE MirrorClampToEdge WrapMode = C.GL_MIRROR_CLAMP_TO_EDGE Repeat WrapMode = C.GL_REPEAT MirroredRepeat WrapMode = C.GL_MIRRORED_REPEAT )
Used in `Sampler.Wrap`.