NGL
6.5
The NCCA Graphics Library
|
Simple indexed vao using one buffer and float data see https://github.com/NCCA/VertexArrayObject/tree/master/SimpleIndexVAOFactory for examples of use. More...
#include <SimpleIndexVAO.h>
Classes | |
class | VertexData |
Public Member Functions | |
virtual void | draw () const |
draw the VAO using glDrawArrays More... | |
virtual | ~SimpleIndexVAO () |
dtor don't do anything as the remove clears things More... | |
virtual void | removeVAO () |
remove the VAO and buffers created More... | |
virtual void | setData (const AbstractVAO::VertexData &_data) |
, this method sets the data for the VAO if data has already been set it will remove the existing data and then re-set with the new data. More... | |
GLuint | getBufferID (unsigned int) |
return the id of the buffer, if there is only 1 buffer just return this if we have the more than one buffer the sub class manages the id's More... | |
Public Member Functions inherited from ngl::AbstractVAO | |
virtual | ~AbstractVAO ()=default |
dtor usually this will not be called More... | |
void | bind () |
bind the VAO so it can be used. More... | |
void | unbind () |
unbind the VAO by binding default 0 More... | |
void | setVertexAttributePointer (GLuint _id, GLint _size, GLenum _type, GLsizei _stride, unsigned int _dataOffset, bool _normalise=false) |
set the generic vertex attribute pointer data usually this method will do however the user may occasionally need to override this method. More... | |
void | setNumIndices (size_t _s) |
the number of indices to draw in the array. It may be that the draw routine can overide this at another time. More... | |
GLenum | getMode () const |
get the draw mode More... | |
void | setMode (const GLenum &_mode) |
set the draw mode More... | |
Static Public Member Functions | |
static AbstractVAO * | create (GLenum _mode=GL_TRIANGLES) |
creator method for the factory More... | |
Protected Member Functions | |
SimpleIndexVAO (GLenum _mode) | |
ctor calles parent ctor to allocate vao; More... | |
Protected Member Functions inherited from ngl::AbstractVAO | |
AbstractVAO (GLenum _mode=GL_TRIANGLES) | |
Private Attributes | |
GLuint | m_buffer =0 |
the id of the buffer for the VAO More... | |
GLenum | m_indexType |
data type of the index data (e.g. GL_UNSIGNED_INT) More... | |
Additional Inherited Members | |
Protected Attributes inherited from ngl::AbstractVAO | |
GLenum | m_mode =GL_TRIANGLES |
the draw mode More... | |
GLuint | m_id =0 |
the id of the VAO allocated from OpenGL More... | |
bool | m_bound =false |
debug flag to indicate if the vao is bound. More... | |
bool | m_allocated =false |
debug flag to indicate if data has been set for the VAO More... | |
size_t | m_indicesCount =0 |
the number of indices stored in the VAO. More... | |
Simple indexed vao using one buffer and float data see https://github.com/NCCA/VertexArrayObject/tree/master/SimpleIndexVAOFactory for examples of use.
Definition at line 34 of file SimpleIndexVAO.h.
|
virtual |
dtor don't do anything as the remove clears things
Definition at line 5 of file SimpleIndexVAO.cpp.
References removeVAO().
|
inlineprotected |
ctor calles parent ctor to allocate vao;
Definition at line 93 of file SimpleIndexVAO.h.
|
inlinestatic |
creator method for the factory
_mode | the mode to draw with. |
Definition at line 55 of file SimpleIndexVAO.h.
|
virtual |
draw the VAO using glDrawArrays
Implements ngl::AbstractVAO.
Definition at line 10 of file SimpleIndexVAO.cpp.
References glDrawElements(), ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, m_indexType, ngl::AbstractVAO::m_indicesCount, and ngl::AbstractVAO::m_mode.
return the id of the buffer, if there is only 1 buffer just return this if we have the more than one buffer the sub class manages the id's
_buffer | index (default to 0 for single buffer VAO's) |
Implements ngl::AbstractVAO.
Definition at line 87 of file SimpleIndexVAO.h.
|
virtual |
remove the VAO and buffers created
Implements ngl::AbstractVAO.
Definition at line 23 of file SimpleIndexVAO.cpp.
References glDeleteBuffers, glDeleteVertexArrays, ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, m_buffer, ngl::AbstractVAO::m_id, and ngl::AbstractVAO::unbind().
|
virtual |
, this method sets the data for the VAO if data has already been set it will remove the existing data and then re-set with the new data.
_size | the size of the raw data passed |
_data | the actual data to set for the VOA |
_indexSize | the size of the index array passed |
_indexData | the actual data to set for the VOA indexes (only GLubyte data at present need to write more methods but usually only use this |
_indexType | the type of the values in the indices buffer. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT. |
_mode | the draw mode hint used by GL |
Implements ngl::AbstractVAO.
Definition at line 39 of file SimpleIndexVAO.cpp.
References GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, glBindBuffer, glBufferData, glGenBuffers, ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, ngl::AbstractVAO::VertexData::m_data, ngl::SimpleIndexVAO::VertexData::m_indexData, ngl::SimpleIndexVAO::VertexData::m_indexSize, ngl::SimpleIndexVAO::VertexData::m_indexType, m_indexType, ngl::AbstractVAO::VertexData::m_mode, and ngl::AbstractVAO::VertexData::m_size.
|
private |
the id of the buffer for the VAO
Definition at line 102 of file SimpleIndexVAO.h.
|
private |
data type of the index data (e.g. GL_UNSIGNED_INT)
Definition at line 106 of file SimpleIndexVAO.h.