buffers

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufUsage

type BufUsage int
const (
	BufUsage_Unknown BufUsage = iota

	//Buffer is set only once and used many times
	BufUsage_Static
	//Buffer is changed a lot and used many times
	BufUsage_Dynamic
	//Buffer is set only once and used by the GPU at most a few times
	BufUsage_Stream
)

func (BufUsage) ToGL added in v0.0.3

func (b BufUsage) ToGL() uint32

type Element added in v0.0.3

type Element struct {
	Offset int
	ElementType
}

Element represents an element that makes up a buffer (e.g. Vec3 at an offset of 12 bytes)

type ElementType added in v0.0.3

type ElementType int

ElementType is the type of an element thats makes up a buffer (e.g. Vec3)

const (
	DataTypeUnknown ElementType = iota
	DataTypeUint32
	DataTypeInt32
	DataTypeFloat32

	DataTypeVec2
	DataTypeVec3
	DataTypeVec4
)

func (ElementType) CompCount added in v0.0.3

func (dt ElementType) CompCount() int32

CompCount returns the number of components in the element (e.g. for Vec2 its 2)

func (ElementType) CompSize added in v0.0.3

func (dt ElementType) CompSize() int32

CompSize returns the size in bytes for one component of the type (e.g. for Vec2 its 4)

func (ElementType) GLType added in v0.0.3

func (dt ElementType) GLType() uint32

func (ElementType) Size added in v0.0.3

func (dt ElementType) Size() int32

Size returns the total size in bytes (e.g. for vec3 its 3*4=12 bytes)

type Framebuffer added in v0.20.0

type Framebuffer struct {
	Id                    uint32
	ClearFlags            uint32
	Attachments           []FramebufferAttachment
	ColorAttachmentsCount uint32
	Width                 uint32
	Height                uint32
}

func NewFramebuffer added in v0.20.0

func NewFramebuffer(width, height uint32) Framebuffer

func (*Framebuffer) Bind added in v0.20.0

func (fbo *Framebuffer) Bind()

func (*Framebuffer) BindWithViewport added in v0.20.0

func (fbo *Framebuffer) BindWithViewport()

func (*Framebuffer) Clear added in v0.21.0

func (fbo *Framebuffer) Clear()

Clear calls gl.Clear with the fbo's clear flags. Note that the fbo must be complete and bound. Calling this without a bound fbo will clear something else, like your screen.

func (*Framebuffer) Delete added in v0.20.0

func (fbo *Framebuffer) Delete()

func (*Framebuffer) HasColorAttachment added in v0.20.0

func (fbo *Framebuffer) HasColorAttachment() bool

func (*Framebuffer) HasDepthAttachment added in v0.20.0

func (fbo *Framebuffer) HasDepthAttachment() bool

func (*Framebuffer) IsComplete added in v0.20.0

func (fbo *Framebuffer) IsComplete() bool

IsComplete returns true if OpenGL reports that the fbo is complete/usable. Note that this function binds and then unbinds the fbo

func (*Framebuffer) NewColorAttachment added in v0.20.0

func (fbo *Framebuffer) NewColorAttachment(
	attachType FramebufferAttachmentType,
	attachFormat FramebufferAttachmentDataFormat,
)

func (*Framebuffer) NewDepthAttachment added in v0.21.0

func (fbo *Framebuffer) NewDepthAttachment(
	attachType FramebufferAttachmentType,
	attachFormat FramebufferAttachmentDataFormat,
)

func (*Framebuffer) NewDepthCubemapArrayAttachment added in v0.22.0

func (fbo *Framebuffer) NewDepthCubemapArrayAttachment(
	attachFormat FramebufferAttachmentDataFormat,
	numCubemaps int32,
)

func (*Framebuffer) NewDepthStencilAttachment added in v0.20.0

func (fbo *Framebuffer) NewDepthStencilAttachment(
	attachType FramebufferAttachmentType,
	attachFormat FramebufferAttachmentDataFormat,
)

func (*Framebuffer) NewDepthTextureArrayAttachment added in v0.23.0

func (fbo *Framebuffer) NewDepthTextureArrayAttachment(
	attachFormat FramebufferAttachmentDataFormat,
	numTextures int32,
)

func (*Framebuffer) SetCubemapArrayLayerFace added in v0.22.0

func (fbo *Framebuffer) SetCubemapArrayLayerFace(layerFace int32)

SetCubemapArrayLayerFace 'binds' a single face of a cubemap from the cubemap array to the fbo, such that rendering only affects that one face and the others inaccessible.

If this is not called, the default is that the entire cubemap array and all the faces in it are bound and available for use when binding the fbo.

func (*Framebuffer) SetNoColorBuffer added in v0.21.0

func (fbo *Framebuffer) SetNoColorBuffer()

SetNoColorBuffer sets the read and draw buffers of this fbo to 'NONE', which tells the graphics driver that we don't want a color buffer for this fbo.

This is required because normally an fbo must have a color buffer to be considered complete, but by doing this we get marked as complete even without one.

Usually used when you only care about some other buffer, like a depth buffer.

func (*Framebuffer) UnBind added in v0.20.0

func (fbo *Framebuffer) UnBind()

func (*Framebuffer) UnBindWithViewport added in v0.20.0

func (fbo *Framebuffer) UnBindWithViewport(width, height uint32)

type FramebufferAttachment added in v0.20.0

type FramebufferAttachment struct {
	Id     uint32
	Type   FramebufferAttachmentType
	Format FramebufferAttachmentDataFormat
}

type FramebufferAttachmentDataFormat added in v0.20.0

type FramebufferAttachmentDataFormat int32
const (
	FramebufferAttachmentDataFormat_Unknown FramebufferAttachmentDataFormat = iota
	FramebufferAttachmentDataFormat_R32Int
	FramebufferAttachmentDataFormat_RGBA8
	FramebufferAttachmentDataFormat_RGBAF16
	FramebufferAttachmentDataFormat_SRGBA
	FramebufferAttachmentDataFormat_DepthF32
	FramebufferAttachmentDataFormat_Depth24Stencil8
)

func (FramebufferAttachmentDataFormat) GlComponentType added in v0.25.0

func (f FramebufferAttachmentDataFormat) GlComponentType() uint32

func (FramebufferAttachmentDataFormat) GlFormat added in v0.20.0

func (FramebufferAttachmentDataFormat) GlInternalFormat added in v0.20.0

func (f FramebufferAttachmentDataFormat) GlInternalFormat() int32

func (FramebufferAttachmentDataFormat) IsColorFormat added in v0.20.0

func (f FramebufferAttachmentDataFormat) IsColorFormat() bool

func (FramebufferAttachmentDataFormat) IsDepthFormat added in v0.20.0

func (f FramebufferAttachmentDataFormat) IsDepthFormat() bool

type FramebufferAttachmentType added in v0.20.0

type FramebufferAttachmentType int32
const (
	FramebufferAttachmentType_Unknown FramebufferAttachmentType = iota
	FramebufferAttachmentType_Texture
	FramebufferAttachmentType_Texture_Array
	FramebufferAttachmentType_Renderbuffer
	FramebufferAttachmentType_Cubemap
	FramebufferAttachmentType_Cubemap_Array
)

func (FramebufferAttachmentType) IsValid added in v0.20.0

func (f FramebufferAttachmentType) IsValid() bool

type IndexBuffer added in v0.19.9

type IndexBuffer struct {
	Id uint32
	// IndexBufCount is the number of elements in the index buffer. Updated in IndexBuffer.SetData
	IndexBufCount int32
}

func NewIndexBuffer added in v0.19.9

func NewIndexBuffer() IndexBuffer

func (*IndexBuffer) Bind added in v0.19.9

func (ib *IndexBuffer) Bind()

func (*IndexBuffer) SetData added in v0.19.9

func (ib *IndexBuffer) SetData(values []uint32)

func (*IndexBuffer) UnBind added in v0.19.9

func (ib *IndexBuffer) UnBind()

type VertexArray added in v0.19.9

type VertexArray struct {
	Id          uint32
	Vbos        []VertexBuffer
	IndexBuffer IndexBuffer
}

func NewVertexArray added in v0.19.9

func NewVertexArray() VertexArray

func (*VertexArray) AddVertexBuffer added in v0.19.9

func (va *VertexArray) AddVertexBuffer(vbo VertexBuffer)

func (*VertexArray) Bind added in v0.19.9

func (va *VertexArray) Bind()

func (*VertexArray) SetIndexBuffer added in v0.19.9

func (va *VertexArray) SetIndexBuffer(ib IndexBuffer)

func (*VertexArray) UnBind added in v0.19.9

func (va *VertexArray) UnBind()

type VertexBuffer added in v0.19.9

type VertexBuffer struct {
	Id     uint32
	Stride int32
	// contains filtered or unexported fields
}

func NewVertexBuffer added in v0.19.9

func NewVertexBuffer(layout ...Element) VertexBuffer

func (*VertexBuffer) Bind added in v0.19.9

func (vb *VertexBuffer) Bind()

func (*VertexBuffer) GetLayout added in v0.19.9

func (vb *VertexBuffer) GetLayout() []Element

func (*VertexBuffer) SetData added in v0.19.9

func (vb *VertexBuffer) SetData(values []float32, usage BufUsage)

func (*VertexBuffer) SetLayout added in v0.19.9

func (vb *VertexBuffer) SetLayout(layout ...Element)

func (*VertexBuffer) UnBind added in v0.19.9

func (vb *VertexBuffer) UnBind()

Jump to

Keyboard shortcuts

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