11 #ifndef SLGLVERTEXARRAY_H 
   12 #define SLGLVERTEXARRAY_H 
  101                     void*          indexDataElements,
 
  103                     void*          indexDataEdges  = 
nullptr);
 
  111                    (
void*)&indicesElements->operator[](0),
 
  112                    indicesEdges ? (
SLuint)indicesEdges->size() : 0,
 
  113                    indicesEdges && indicesEdges->size() ? (
void*)&indicesEdges->operator[](0) : 
nullptr);
 
  122                    (
void*)&indicesElements->operator[](0),
 
  123                    indicesEdges ? (
SLuint)indicesEdges->size() : 0,
 
  124                    indicesEdges && indicesEdges->size() ? (
void*)&indicesEdges->operator[](0) : 
nullptr);
 
  129                     SLVuint* indicesEdges = 
nullptr)
 
  133                    (
void*)&indicesElements->operator[](0),
 
  134                    indicesEdges ? (
SLuint)indicesEdges->size() : 0,
 
  135                    indicesEdges && indicesEdges->size() ? (
void*)&indicesEdges->operator[](0) : 
nullptr);
 
  169                   SLbool          outputInterleaved = 
true,
 
  175                     SLbool          outputInterleaved = 
true,
 
  187                         SLuint            indexOffsetBytes = 0);
 
  191                      SLint             firstVertex   = 0,
 
vector< SLubyte > SLVubyte
 
vector< SLfloat > SLVfloat
 
vector< SLushort > SLVushort
 
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.
 
@ BT_ubyte
vertex index type (0-2^8)
 
@ BT_ushort
vertex index type (0-2^16)
 
@ BT_float
float vertex attributes
 
@ BT_int
int vertex attributes
 
@ BT_uint
vertex index type (0-2^32)
 
Wrapper class around OpenGL Vertex Buffer Objects (VBO)
 
vector< SLVec2f > SLVVec2f
 
vector< SLVec3f > SLVVec3f
 
vector< SLVec4f > SLVVec4f
 
vector< SLVec4i > SLVVec4i
 
SLGLVertexArray encapsulates the core OpenGL drawing.
 
void updateAttrib(SLGLAttributeType type, SLVVec3f *data)
Updates a specific vertex attribute in the VBO.
 
SLGLVertexBuffer _vbo
NO. of vertices in array.
 
size_t _numIndicesEdges
Pointer to index data for elements.
 
void beginTF(SLuint tfoID)
Begin transform feedback.
 
SLGLVertexBuffer * _instanceVbo
index data type (ubyte, ushort, uint)
 
SLuint numVertices() const
 
void setAttrib(SLGLAttributeType type, SLint location, SLVVec4i *data)
Adds a vertex attribute with vector of SLVec4i.
 
void setIndices(SLVubyte *indicesElements, SLVubyte *indicesEdges=nullptr)
Adds the index array for indexed element drawing with a vector of ubyte.
 
SLuint _idVBOIndices
Vertex buffer object for float attributes.
 
void clearAttribs()
Clears the attribute definition.
 
void setInstanceVBO(SLGLVertexBuffer *vbo, SLuint divisor=0)
Attach a VBO that has been created outside of this VAO.
 
void * _indexDataEdges
NO. of vertex indices in array for hard edges.
 
void endTF()
End transform feedback.
 
SLuint tfoID() const
Returns the TFO id.
 
size_t _numIndicesElements
OpenGL id of index vbo.
 
SLuint _vaoID
Number of instances of drawing.
 
SLuint _tfoID
OpenGL id of vertex array object.
 
void updateAttrib(SLGLAttributeType type, SLVVec4f *data)
Updates a specific vertex attribute in the VBO.
 
void updateAttrib(SLGLAttributeType type, SLVfloat *data)
Updates a specific vertex attribute in the VBO.
 
static SLuint totalDrawCalls
 
void updateAttrib(SLGLAttributeType type, SLint elementSize, void *dataPointer)
Updates a specific vertex attribute in the VBO.
 
void setAttrib(SLGLAttributeType type, SLint location, SLVuint *data)
Adds a vertex attribute with vector of SLuint.
 
void drawElementsAs(SLGLPrimitiveType primitiveType, SLuint numIndexes=0, SLuint indexOffsetBytes=0)
Draws the VAO by element indices with a primitive type.
 
void setIndices(SLVushort *indicesElements, SLVushort *indicesEdges=nullptr)
Adds the index array for indexed element drawing with a vector of ushort.
 
void setAttrib(SLGLAttributeType type, SLint elementSize, SLint location, void *dataPointer, SLGLBufferType dataType=BT_float)
Adds a vertex attribute with data pointer and an element size.
 
static SLuint totalPrimitivesRendered
static total no. of draw calls
 
SLGLBufferType _indexDataType
Pointer to index data for hard edges.
 
void setIndices(SLVuint *indicesElements, SLVuint *indicesEdges=nullptr)
Adds the index array for indexed element drawing with a vector of uint.
 
SLuint _instanceDivisor
Vertex buffer object containing the positions for instanced drawing.
 
SLuint _instances
static total no. of primitives rendered
 
SLuint _numVertices
OpenGL id of transform feedback object.
 
void updateAttrib(SLGLAttributeType type, SLVuint *data)
Updates a specific vertex attribute in the VBO.
 
void generateTF(SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true, SLuint divisor=0)
Generates the VA & VB & TF objects.
 
void setAttrib(SLGLAttributeType type, SLint location, SLVfloat *data)
Adds a vertex attribute with vector of SLfloat.
 
void drawArrayAs(SLGLPrimitiveType primitiveType, SLint firstVertex=0, SLsizei countVertices=0)
Draws the VAO as an array with a primitive type.
 
SLuint numIndicesElements() const
 
void drawElementsInstanced(SLGLPrimitiveType primitiveType, SLuint countInstance=0, SLuint numIndexes=0, SLuint indexOffset=0)
Draws the VAO as an array with instance primitive type.
 
void updateAttrib(SLGLAttributeType type, SLVVec2f *data)
Updates a specific vertex attribute in the VBO.
 
void * _indexDataElements
NO. of vertex indices in array for triangles, lines or points.
 
SLuint vaoID() const
Returns either the VAO id or the VBO id.
 
void setIndices(SLuint numIndicesElements, SLGLBufferType indexDataType, void *indexDataElements, SLuint numIndicesEdges=0, void *indexDataEdges=nullptr)
Adds the index array for indexed element drawing.
 
void generate(SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true, SLuint divisor=0)
Generates the VA & VB objects for a NO. of vertices.
 
void drawEdges(SLCol4f color, SLfloat lineWidth=1.0f)
Draws the hard edges of the VAO with the edge indices.
 
void setAttrib(SLGLAttributeType type, SLint location, SLVVec2f *data)
Adds a vertex attribute with vector of SLVec2f.
 
void setAttrib(SLGLAttributeType type, SLint location, SLVVec3f *data)
Adds a vertex attribute with vector of SLVec3f.
 
void deleteGL()
Deletes all vertex array & vertex buffer objects.
 
void setAttrib(SLGLAttributeType type, SLint location, SLVVec4f *data)
Adds a vertex attribute with vector of SLVec4f.
 
SLuint numIndicesEdges() const
 
SLGLVertexBuffer encapsulates an OpenGL buffer for vertex attributes.
 
void clear()
Calls deleteGL & clears the attributes.