NGL
6.5
The NCCA Graphics Library
|
Simple non index vao using multiple buffers see https://github.com/NCCA/VertexArrayObject/tree/master/MultiBufferVAOFactory for examples of use. More...
#include <MultiBufferVAO.h>
Public Member Functions | |
virtual void | draw () const |
draw the VAO using glDrawArrays More... | |
virtual | ~MultiBufferVAO () |
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 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... | |
virtual GLuint | getBufferID (unsigned int _id) |
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 | |
MultiBufferVAO (GLenum _mode) | |
ctor calles parent ctor to allocate vao; More... | |
Protected Member Functions inherited from ngl::AbstractVAO | |
AbstractVAO (GLenum _mode=GL_TRIANGLES) | |
Private Attributes | |
std::vector< GLuint > | m_vboIDs |
the id of the buffers for the VAO 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 non index vao using multiple buffers see https://github.com/NCCA/VertexArrayObject/tree/master/MultiBufferVAOFactory for examples of use.
Definition at line 34 of file MultiBufferVAO.h.
|
virtual |
dtor don't do anything as the remove clears things
Definition at line 6 of file MultiBufferVAO.cpp.
References removeVAO().
|
inlineprotected |
ctor calles parent ctor to allocate vao;
Definition at line 70 of file MultiBufferVAO.h.
|
inlinestatic |
creator method for the factory
_mode | the mode to draw with. |
Definition at line 42 of file MultiBufferVAO.h.
|
virtual |
draw the VAO using glDrawArrays
Implements ngl::AbstractVAO.
Definition at line 11 of file MultiBufferVAO.cpp.
References glDrawArrays(), ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, 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 57 of file MultiBufferVAO.cpp.
References m_vboIDs, and NGL_ASSERT.
|
virtual |
remove the VAO and buffers created
Implements ngl::AbstractVAO.
Definition at line 24 of file MultiBufferVAO.cpp.
References glDeleteBuffers, glDeleteVertexArrays, ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, ngl::AbstractVAO::m_id, m_vboIDs, 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.
Implements ngl::AbstractVAO.
Definition at line 40 of file MultiBufferVAO.cpp.
References GL_ARRAY_BUFFER, glBindBuffer, glBufferData, glGenBuffers, ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, ngl::AbstractVAO::VertexData::m_data, ngl::AbstractVAO::VertexData::m_mode, ngl::AbstractVAO::VertexData::m_size, and m_vboIDs.
|
private |
the id of the buffers for the VAO
Definition at line 79 of file MultiBufferVAO.h.