NGL  6.5
The NCCA Graphics Library
ngl::MultiBufferVAO Class Reference

Simple non index vao using multiple buffers see https://github.com/NCCA/VertexArrayObject/tree/master/MultiBufferVAOFactory for examples of use. More...

#include <MultiBufferVAO.h>

+ Inheritance diagram for ngl::MultiBufferVAO:
+ Collaboration diagram for ngl::MultiBufferVAO:

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 AbstractVAOcreate (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< GLuintm_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...
 

Detailed Description

Simple non index vao using multiple buffers see https://github.com/NCCA/VertexArrayObject/tree/master/MultiBufferVAOFactory for examples of use.

Author
Jonathan Macey
Version
1.0
Date
6/4/16

Definition at line 34 of file MultiBufferVAO.h.

Constructor & Destructor Documentation

ngl::MultiBufferVAO::~MultiBufferVAO ( )
virtual

dtor don't do anything as the remove clears things

Definition at line 6 of file MultiBufferVAO.cpp.

References removeVAO().

+ Here is the call graph for this function:

ngl::MultiBufferVAO::MultiBufferVAO ( GLenum  _mode)
inlineprotected

ctor calles parent ctor to allocate vao;

Definition at line 70 of file MultiBufferVAO.h.

Member Function Documentation

static AbstractVAO* ngl::MultiBufferVAO::create ( GLenum  _mode = GL_TRIANGLES)
inlinestatic

creator method for the factory

Parameters
_modethe mode to draw with.
Returns
a new AbstractVAO * object

Definition at line 42 of file MultiBufferVAO.h.

+ Here is the caller graph for this function:

void ngl::MultiBufferVAO::draw ( ) const
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.

+ Here is the call graph for this function:

GLuint ngl::MultiBufferVAO::getBufferID ( unsigned int  _id)
virtual

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

Parameters
_bufferindex (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.

void ngl::MultiBufferVAO::removeVAO ( )
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ngl::MultiBufferVAO::setData ( const VertexData _data)
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.

Member Data Documentation

std::vector<GLuint> ngl::MultiBufferVAO::m_vboIDs
private

the id of the buffers for the VAO

Definition at line 79 of file MultiBufferVAO.h.


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