buffers

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 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 Buffer

type Buffer struct {
	VAOID uint32
	//BufID is the ID of the VBO
	BufID uint32
	//IndexBufID is the ID of the index/element buffer
	IndexBufID    uint32
	IndexBufCount int32
	Stride        int32
	// contains filtered or unexported fields
}

func NewBuffer added in v0.0.3

func NewBuffer(layout ...Element) Buffer

func (*Buffer) Bind added in v0.0.3

func (b *Buffer) Bind()

func (*Buffer) GetLayout added in v0.0.3

func (b *Buffer) GetLayout() []Element

func (*Buffer) SetData added in v0.0.3

func (b *Buffer) SetData(values []float32)

func (*Buffer) SetIndexBufData added in v0.0.3

func (b *Buffer) SetIndexBufData(values []uint32)

func (*Buffer) SetLayout added in v0.0.3

func (b *Buffer) SetLayout(layout ...Element)

func (*Buffer) UnBind added in v0.0.3

func (b *Buffer) UnBind()

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)

Jump to

Keyboard shortcuts

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