Documentation
¶
Index ¶
- type BufGLType
- type BufType
- type BufUsage
- type Buffer
- type BufferObject
- func (bo *BufferObject) Activate()
- func (bo *BufferObject) Deactivate()
- func (bo *BufferObject) GenBuffer(data []float32, bufUsage BufUsage, bufType BufType, bufDataType DataType)
- func (bo *BufferObject) GenBufferUint32(data []uint32, bufUsage BufUsage, bufType BufType, bufDataType DataType)
- func (bo *BufferObject) SetBuffer(buf *Buffer)
- type DataType
- type DataTypeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufGLType ¶
type BufGLType int
const ( BufGLTypeUnknown BufGLType = 0 //Generic array of data. Should be used for most data like vertex positions, vertex colors etc. BufGLTypeArray BufGLType = gl.ARRAY_BUFFER BufGLTypeIndices BufGLType = gl.ELEMENT_ARRAY_BUFFER )
type BufUsage ¶
type BufUsage int
const ( //Buffer is set only once and used many times BufUsageStatic BufUsage = gl.STATIC_DRAW //Buffer is changed a lot and used many times BufUsageDynamic BufUsage = gl.DYNAMIC_DRAW //Buffer is set only once and used by the GPU at most a few times BufUsageStream BufUsage = gl.STREAM_DRAW )
type Buffer ¶
type Buffer struct {
ID uint32
Type BufType
GLType BufGLType
DataTypeInfo
}
func (*Buffer) Deactivate ¶
func (b *Buffer) Deactivate()
type BufferObject ¶
type BufferObject struct {
VAOID uint32
VertPosBuf *Buffer
NormalBuf *Buffer
ColorBuf *Buffer
IndexBuf *Buffer
}
func NewBufferObject ¶
func NewBufferObject() *BufferObject
func (*BufferObject) Activate ¶
func (bo *BufferObject) Activate()
func (*BufferObject) Deactivate ¶
func (bo *BufferObject) Deactivate()
func (*BufferObject) GenBuffer ¶
func (bo *BufferObject) GenBuffer(data []float32, bufUsage BufUsage, bufType BufType, bufDataType DataType)
func (*BufferObject) GenBufferUint32 ¶
func (bo *BufferObject) GenBufferUint32(data []uint32, bufUsage BufUsage, bufType BufType, bufDataType DataType)
func (*BufferObject) SetBuffer ¶
func (bo *BufferObject) SetBuffer(buf *Buffer)
type DataTypeInfo ¶
type DataTypeInfo struct {
//ElementSize is size in bytes of one element (e.g. for vec3 its 4)
ElementSize int32
//ElementCount is number of elements (e.g. for vec3 its 3)
ElementCount int32
//ElementType is the type of each primitive (e.g. for vec3 its gl.FLOAT)
ElementType uint32
//GLType is the type of the variable represented (e.g. for vec3 its gl.FLOAT_VEC2)
GLType uint32
}
func GetDataTypeInfo ¶
func GetDataTypeInfo(dt DataType) DataTypeInfo
func (*DataTypeInfo) GetSize ¶
func (dti *DataTypeInfo) GetSize() int32
GetSize returns the total size in bytes (e.g. for vec3 its 4*3)
Click to show internal directories.
Click to hide internal directories.