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

Simple non index vao using one buffer and float data see https://github.com/NCCA/VertexArrayObject/tree/master/SimpleVAOFactory for examples of use. More...

#include <SimpleVAO.h>

+ Inheritance diagram for ngl::SimpleVAO:
+ Collaboration diagram for ngl::SimpleVAO:

Public Member Functions

virtual void draw () const
 draw the VAO using glDrawArrays More...
 
virtual ~SimpleVAO ()
 dtor clears the VAO data 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...
 
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 AbstractVAOcreate (GLenum _mode=GL_TRIANGLES)
 creator method for the factory More...
 

Protected Member Functions

 SimpleVAO (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...
 

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 one buffer and float data see https://github.com/NCCA/VertexArrayObject/tree/master/SimpleVAOFactory for examples of use.

Author
Jonathan Macey
Version
1.0
Date
6/4/16

Definition at line 34 of file SimpleVAO.h.

Constructor & Destructor Documentation

ngl::SimpleVAO::~SimpleVAO ( )
virtual

dtor clears the VAO data

Definition at line 5 of file SimpleVAO.cpp.

References removeVAO().

+ Here is the call graph for this function:

ngl::SimpleVAO::SimpleVAO ( GLenum  _mode)
inlineprotected

ctor calles parent ctor to allocate vao;

Definition at line 71 of file SimpleVAO.h.

Member Function Documentation

static AbstractVAO* ngl::SimpleVAO::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 SimpleVAO.h.

+ Here is the caller graph for this function:

void ngl::SimpleVAO::draw ( ) const
virtual

draw the VAO using glDrawArrays

Implements ngl::AbstractVAO.

Definition at line 10 of file SimpleVAO.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::SimpleVAO::getBufferID ( unsigned int  )
inlinevirtual

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 65 of file SimpleVAO.h.

void ngl::SimpleVAO::removeVAO ( )
virtual

remove the VAO and buffers created

Implements ngl::AbstractVAO.

Definition at line 23 of file SimpleVAO.cpp.

References glDeleteBuffers, glDeleteVertexArrays, ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, m_buffer, ngl::AbstractVAO::m_id, and ngl::AbstractVAO::unbind().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ngl::SimpleVAO::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 37 of file SimpleVAO.cpp.

References GL_ARRAY_BUFFER, glBindBuffer, glBufferData, glDeleteBuffers, glGenBuffers, ngl::AbstractVAO::m_allocated, ngl::AbstractVAO::m_bound, m_buffer, ngl::AbstractVAO::VertexData::m_data, ngl::AbstractVAO::VertexData::m_mode, and ngl::AbstractVAO::VertexData::m_size.

Member Data Documentation

GLuint ngl::SimpleVAO::m_buffer =0
private

the id of the buffer for the VAO

Definition at line 80 of file SimpleVAO.h.


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