11 #ifndef SLGLVERTEXBUFFER_H
12 #define SLGLVERTEXBUFFER_H
87 SLbool outputInterleaved =
true);
vector< SLfloat > SLVfloat
Enumerations containing OpenGL constants.
SLGLAttributeType
Enumeration for float vertex attribute types.
SLGLBufferUsage
Enumeration for buffer usage types also supported by OpenGL ES.
@ BU_static
Buffer will be modified once and used many times.
SLGLBufferType
Enumeration for buffer data types.
vector< SLGLAttribute > SLVVertexAttrib
vector< SLVec2f > SLVVec2f
vector< SLVec3f > SLVVec3f
vector< SLVec4f > SLVVec4f
SLGLVertexBuffer encapsulates an OpenGL buffer for vertex attributes.
void updateAttrib(SLGLAttributeType type, SLVuint &data)
Updates a specific vertex attribute in the VBO.
SLint attribIndex(SLGLAttributeType type)
Returns the vector index if a vertex attribute exists otherwise -1.
void generate(SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true)
Generates the VBO.
SLuint _sizeBytes
Distance for interleaved attributes in bytes.
static SLuint totalBufferSize
static total no. of buffers in use
void updateAttrib(SLGLAttributeType type, SLVVec3f &data)
Updates a specific vertex attribute in the VBO.
SLbool _outputIsInterleaved
Vector of vertex attributes.
void updateAttrib(SLGLAttributeType type, SLVVec2f &data)
Updates a specific vertex attribute in the VBO.
SLGLBufferUsage _usage
Total size of float VBO in bytes.
void updateAttrib(SLGLAttributeType type, SLVfloat &data)
Updates a specific vertex attribute in the VBO.
static SLuint totalBufferCount
SLVVertexAttrib _attribs
NO. of vertices in array.
SLuint _numVertices
OpenGL id of vertex buffer object.
SLGLVertexBuffer()
Constructor initializing with default values.
SLbool _inputIsInterleaved
Flag if VBO should be generated interleaved.
void clear()
Calls deleteGL & clears the attributes.
static SLuint sizeOfType(SLGLBufferType type)
static total size of all buffers in bytes
void updateAttrib(SLGLAttributeType type, SLVVec4f &data)
Updates a specific vertex attribute in the VBO.
void deleteGL()
Deletes all vertex array & vertex buffer objects.
SLuint _strideBytes
Flag if VBO should be generated interleaved.
SLVVertexAttrib & attribs()
SLbool outputIsInterleaved() const
void disableAttrib()
disables the vertex attribute for OpenGL < 3.0
void bindAndEnableAttrib(SLuint divisor=0) const
Binds & enables the vertex attribute for OpenGL < 3.0 and during VAO creation.
void updateAttrib(SLGLAttributeType type, SLint elementSize, void *dataPointer)
Updates a specific vertex attribute in the VBO.
Struct for vertex attribute information.
SLGLAttributeType type
type of vertex attribute
SLint location
GLSL input variable location index.
SLint elementSize
size of attribute element (SLVec3f has 3)
SLuint offsetBytes
Data Type (BT_float, BT_ubyte,...)
SLuint bufferSizeBytes
size of the attribute part in the buffer
void * dataPointer
pointer to the attributes source data