buffers

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 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 (
	//Buffer is set only once and used many times
	BufUsage_Static BufUsage = iota
	//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 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