SLProject 4.0.000
SLGLVertexArrayExt Class Reference

SLGLVertexArray adds Helper Functions for quick Line & Point Drawing. More...

#include <SLGLVertexArrayExt.h>

Inheritance diagram for SLGLVertexArrayExt:
[legend]

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...
 
SLint vaoID () const
 Returns either the VAO id or the VBO id. More...
 
SLint 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 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 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)
 Generates the VA & VB objects for a NO. of vertices. More...
 
void generateTF (SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true)
 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 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
 

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 _vaoID
 static total no. of primitives rendered More...
 
SLuint _tfoID
 OpenGL id of vertex array object. More...
 
SLuint _numVertices
 OpenGL id of transform feedback object. More...
 
SLGLVertexBuffer _VBOf
 NO. of vertices in array. More...
 
SLuint _idVBOIndices
 Vertex buffer object for float attributes. More...
 
SLuint _numIndicesElements
 OpenGL id of index vbo. More...
 
void * _indexDataElements
 NO. of vertex indices in array for triangles, lines or points. More...
 
SLuint _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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SLGLVertexArrayExt()

SLGLVertexArrayExt::SLGLVertexArrayExt ( )
inline

◆ ~SLGLVertexArrayExt()

virtual SLGLVertexArrayExt::~SLGLVertexArrayExt ( )
inlinevirtual

Member Function Documentation

◆ drawArrayAsColored()

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

◆ drawElementAsColored()

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

◆ generateVertexPos() [1/4]

void SLGLVertexArrayExt::generateVertexPos ( SLuint  numVertices,
SLint  elementSize,
void *  dataPointer 
)
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.

◆ generateVertexPos() [2/4]

void SLGLVertexArrayExt::generateVertexPos ( SLVVec2f p)
inline

Adds or updates & generates a position vertex attribute for colored line or point drawing.

◆ generateVertexPos() [3/4]

void SLGLVertexArrayExt::generateVertexPos ( SLVVec3f p)
inline

Adds or updates & generates a position vertex attribute for colored line or point drawing.

◆ generateVertexPos() [4/4]

void SLGLVertexArrayExt::generateVertexPos ( SLVVec4f p)
inline

Adds or updates & generates a position vertex attribute for colored line or point drawing.


The documentation for this class was generated from the following files: