SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
SLGLVertexArray adds Helper Functions for quick Line & Point Drawing. More...
#include <SLGLVertexArrayExt.h>
Public Member Functions | |
SLGLVertexArrayExt () | |
virtual | ~SLGLVertexArrayExt () |
void | generateVertexPos (SLVVec2f *p) |
Adds or updates & generates a position vertex attribute for colored line or point drawing. More... | |
void | generateVertexPos (SLVVec3f *p) |
Adds or updates & generates a position vertex attribute for colored line or point drawing. More... | |
void | generateVertexPos (SLVVec4f *p) |
Adds or updates & generates a position vertex attribute for colored line or point drawing. More... | |
void | drawArrayAsColored (SLGLPrimitiveType primitiveType, SLCol4f color, SLfloat lineOrPointSize=1.0f, SLuint indexFirstVertex=0, SLuint countVertices=0) |
Draws the array as the specified primitive with the color. More... | |
void | drawElementAsColored (SLGLPrimitiveType primitiveType, SLCol4f color, SLfloat pointSize, SLuint indexFirstVertex=0, SLuint countVertices=0) |
Draws the VAO by element indices with the specified primitive with the color. More... | |
Public Member Functions inherited from SLGLVertexArray | |
SLGLVertexArray () | |
~SLGLVertexArray () | |
void | deleteGL () |
Deletes all vertex array & vertex buffer objects. More... | |
void | clearAttribs () |
Clears the attribute definition. More... | |
SLuint | vaoID () const |
Returns either the VAO id or the VBO id. More... | |
SLuint | tfoID () const |
Returns the TFO id. More... | |
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. More... | |
void | setAttrib (SLGLAttributeType type, SLint location, SLVuint *data) |
Adds a vertex attribute with vector of SLuint. More... | |
void | setAttrib (SLGLAttributeType type, SLint location, SLVfloat *data) |
Adds a vertex attribute with vector of SLfloat. More... | |
void | setAttrib (SLGLAttributeType type, SLint location, SLVVec2f *data) |
Adds a vertex attribute with vector of SLVec2f. More... | |
void | setAttrib (SLGLAttributeType type, SLint location, SLVVec3f *data) |
Adds a vertex attribute with vector of SLVec3f. More... | |
void | setAttrib (SLGLAttributeType type, SLint location, SLVVec4f *data) |
Adds a vertex attribute with vector of SLVec4f. More... | |
void | setAttrib (SLGLAttributeType type, SLint location, SLVVec4i *data) |
Adds a vertex attribute with vector of SLVec4i. More... | |
void | setIndices (SLuint numIndicesElements, SLGLBufferType indexDataType, void *indexDataElements, SLuint numIndicesEdges=0, void *indexDataEdges=nullptr) |
Adds the index array for indexed element drawing. More... | |
void | setIndices (SLVubyte *indicesElements, SLVubyte *indicesEdges=nullptr) |
Adds the index array for indexed element drawing with a vector of ubyte. More... | |
void | setIndices (SLVushort *indicesElements, SLVushort *indicesEdges=nullptr) |
Adds the index array for indexed element drawing with a vector of ushort. More... | |
void | setIndices (SLVuint *indicesElements, SLVuint *indicesEdges=nullptr) |
Adds the index array for indexed element drawing with a vector of uint. More... | |
void | setInstanceVBO (SLGLVertexBuffer *vbo, SLuint divisor=0) |
Attach a VBO that has been created outside of this VAO. More... | |
void | updateAttrib (SLGLAttributeType type, SLint elementSize, void *dataPointer) |
Updates a specific vertex attribute in the VBO. More... | |
void | updateAttrib (SLGLAttributeType type, SLVuint *data) |
Updates a specific vertex attribute in the VBO. More... | |
void | updateAttrib (SLGLAttributeType type, SLVfloat *data) |
Updates a specific vertex attribute in the VBO. More... | |
void | updateAttrib (SLGLAttributeType type, SLVVec2f *data) |
Updates a specific vertex attribute in the VBO. More... | |
void | updateAttrib (SLGLAttributeType type, SLVVec3f *data) |
Updates a specific vertex attribute in the VBO. More... | |
void | updateAttrib (SLGLAttributeType type, SLVVec4f *data) |
Updates a specific vertex attribute in the VBO. More... | |
void | generate (SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true, SLuint divisor=0) |
Generates the VA & VB objects for a NO. of vertices. More... | |
void | generateTF (SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true, SLuint divisor=0) |
Generates the VA & VB & TF objects. More... | |
void | beginTF (SLuint tfoID) |
Begin transform feedback. More... | |
void | endTF () |
End transform feedback. More... | |
void | drawElementsAs (SLGLPrimitiveType primitiveType, SLuint numIndexes=0, SLuint indexOffsetBytes=0) |
Draws the VAO by element indices with a primitive type. More... | |
void | drawArrayAs (SLGLPrimitiveType primitiveType, SLint firstVertex=0, SLsizei countVertices=0) |
Draws the VAO as an array with a primitive type. More... | |
void | drawElementsInstanced (SLGLPrimitiveType primitiveType, SLuint countInstance=0, SLuint numIndexes=0, SLuint indexOffset=0) |
Draws the VAO as an array with instance primitive type. More... | |
void | drawEdges (SLCol4f color, SLfloat lineWidth=1.0f) |
Draws the hard edges of the VAO with the edge indices. More... | |
SLuint | numVertices () const |
SLuint | numIndicesElements () const |
SLuint | numIndicesEdges () const |
SLGLVertexBuffer * | vbo () |
Private Member Functions | |
void | generateVertexPos (SLuint numVertices, SLint elementSize, void *dataPointer) |
Adds or updates & generates a position vertex attribute for colored line or point drawing. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from SLGLVertexArray | |
static SLuint | totalDrawCalls = 0 |
static SLuint | totalPrimitivesRendered = 0 |
static total no. of draw calls More... | |
Protected Attributes inherited from SLGLVertexArray | |
SLuint | _instances |
static total no. of primitives rendered More... | |
SLuint | _vaoID |
Number of instances of drawing. More... | |
SLuint | _tfoID |
OpenGL id of vertex array object. More... | |
SLuint | _numVertices |
OpenGL id of transform feedback object. More... | |
SLGLVertexBuffer | _vbo |
NO. of vertices in array. More... | |
SLuint | _idVBOIndices |
Vertex buffer object for float attributes. More... | |
size_t | _numIndicesElements |
OpenGL id of index vbo. More... | |
void * | _indexDataElements |
NO. of vertex indices in array for triangles, lines or points. More... | |
size_t | _numIndicesEdges |
Pointer to index data for elements. More... | |
void * | _indexDataEdges |
NO. of vertex indices in array for hard edges. More... | |
SLGLBufferType | _indexDataType |
Pointer to index data for hard edges. More... | |
SLGLVertexBuffer * | _instanceVbo |
index data type (ubyte, ushort, uint) More... | |
SLuint | _instanceDivisor |
Vertex buffer object containing the positions for instanced drawing. More... | |
SLGLVertexArray adds Helper Functions for quick Line & Point Drawing.
These functions where separated from SLGLVertexAttribute because they use the predefined shader ColorUniform and have there for references to the classes SLScene and SLGLProgram.
Definition at line 22 of file SLGLVertexArrayExt.h.
|
inline |
Definition at line 25 of file SLGLVertexArrayExt.h.
|
inlinevirtual |
Definition at line 26 of file SLGLVertexArrayExt.h.
void SLGLVertexArrayExt::drawArrayAsColored | ( | SLGLPrimitiveType | primitiveType, |
SLCol4f | color, | ||
SLfloat | pointSize = 1.0f , |
||
SLuint | indexFirstVertex = 0 , |
||
SLuint | countVertices = 0 |
||
) |
Draws the array as the specified primitive with the color.
Draws the vertex positions as array with a specified primitive & color
Definition at line 46 of file SLGLVertexArrayExt.cpp.
void SLGLVertexArrayExt::drawElementAsColored | ( | SLGLPrimitiveType | primitiveType, |
SLCol4f | color, | ||
SLfloat | pointSize, | ||
SLuint | indexFirstVertex = 0 , |
||
SLuint | countVertices = 0 |
||
) |
Draws the VAO by element indices with the specified primitive with the color.
Draws the vertex positions as array with a specified primitive & color
Definition at line 93 of file SLGLVertexArrayExt.cpp.
|
private |
Adds or updates & generates a position vertex attribute for colored line or point drawing.
Helper function that sets the vertex position attribute and generates or updates the vertex buffer from it. It is used together with the drawArrayAsColored function.
Definition at line 22 of file SLGLVertexArrayExt.cpp.
Adds or updates & generates a position vertex attribute for colored line or point drawing.
Definition at line 29 of file SLGLVertexArrayExt.h.
Adds or updates & generates a position vertex attribute for colored line or point drawing.
Definition at line 32 of file SLGLVertexArrayExt.h.
Adds or updates & generates a position vertex attribute for colored line or point drawing.
Definition at line 35 of file SLGLVertexArrayExt.h.