74 std::cerr<<
"trying to set VOA data when unbound\n";
92 std::cerr<<
"trying to set VOA data when unbound\n";
114 default : std::cerr<<
"wrong data type send for index value\n";
break;
131 std::cerr<<
"trying to set VOA data when unbound\n";
153 default : std::cerr<<
"wrong data type sent for index value\n";
break;
172 std::cerr<<
"trying to set VOA data when unbound\n";
187 std::cerr<<
"trying to set VOA data when unbound\n";
204 std::cerr<<
"trying to set VOA data when unbound\n";
219 std::cerr<<
"trying to set VOA data when unbound\n";
247 std::cerr<<
"Warning trying to set attribute on Unbound VOA\n";
259 std::cerr<<
"Warning trying to set attribute on Unbound VOA\n";
273 std::cerr<<
"Warning trying to draw an unallocated VOA\n";
277 std::cerr<<
"Warning trying to draw an unbound VOA\n";
295 std::cerr<<
"Warning trying to draw an unallocated VOA\n";
299 std::cerr<<
"Warning trying to draw an unbound VOA\n";
301 glDrawArrays(_mode, static_cast<GLsizei>(_startIndex), static_cast<GLsizei>(_numVerts));
308 std::cerr<<
"Warning trying to draw an unallocated VOA\n";
312 std::cerr<<
"Warning trying to draw an unbound VOA\n";
329 std::cerr<<
"Warning trying to draw an unallocated VOA\n";
333 std::cerr<<
"Warning trying to draw an unbound VOA\n";
375 std::cerr<<
"Warning trying to access an unbound VOA\n";
void setVertexAttributePointer(GLuint _id, GLint _size, GLenum _type, GLsizei _stride, unsigned int _dataOffset, bool _normalise=GL_FALSE)
set the generic vertex attribute pointer data
bool m_indexed
flag to indicate if we have an index or non index vao to draw
#define glGenVertexArrays
#define glVertexAttribIPointer
#define glVertexAttribPointer
void updateData(unsigned int _size, const GLfloat &_data, GLenum _mode=GL_STREAM_DRAW)
allow to update the vertex data of the VBO when declared as dynamic (with GL_STREAM_DRAW) ...
void drawInstanced(GLenum _n) const
draw the VOA _n times using instanced methods from GL (use transform feedback)
#define glEnableVertexAttribArray
#define GL_ELEMENT_ARRAY_BUFFER
void setVertexAttributeIPointer(GLuint _id, GLint _size, GLenum _type, GLsizei _stride, unsigned int _dataOffset)
set the vertex attribute pointer as an Integer this will not be normalised etc
#define glDeleteVertexArrays
GLenum m_drawMode
the draw mode of the VAO e.g. GL_TRIANGLES
int getSize() const
get the size in bytes of the VAO
implementation files for RibExport class
#define glBindVertexArray
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
GLdouble GLdouble GLdouble b
void setData(size_t _size, const GLfloat &_data, GLenum _mode=GL_STATIC_DRAW)
allocate our data using raw face values (for example tri's) data, attributes must be bound to match a...
void freeDataPointer()
unmap the data pointer
bool m_bound
flag to indicate if we are bound
void setRawIndexedData(size_t _size, const GLvoid *_data, unsigned int _indexSize, const GLvoid *_indexData, GLenum _indexType, GLenum _mode=GL_STATIC_DRAW)
allocate our data using raw face values (for example tri's) data, attributes must be bound to match a...
#define glDrawArraysInstanced
GLAPI void GLAPIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
VertexArrayObject()
hide the ctor as we want to create static factory only
void draw() const
draw the VOA
bool m_allocated
flag to indicate if we have allocated the data to the VAO
#define GL_UNSIGNED_SHORT
#define glGetBufferParameteriv
void updateIndexedData(size_t _size, const GLfloat &_data, GLenum _mode=GL_STREAM_DRAW)
allow to update the vertex data of the VBO when declared as dynamic (with GL_STREAM_DRAW) ...
GLuint m_id
the id of the VAO allocated by OpenGL
std::vector< GLuint > m_vboIDs
an array of VBO associated with this VAO
#define glDrawElementsInstanced
void setIndexedData(size_t _size, const GLfloat &_data, unsigned int _indexSize, const GLvoid *_indexData, GLenum _indexType, GLenum _mode=GL_STATIC_DRAW)
allocate our data using raw face values (for example tri's) data, attributes must be bound to match a...
void removeVOA()
delete the VOA (using OpenGL calls to clear data etc)
void unbind()
unbind the VOA and set 0 to be the active VOA
GLuint m_indicesCount
the number of faces to draw
GLuint getVBOid(unsigned int _index)
get the VBO id for the data mapped at index _index basically this will be the vbo for the setData cal...
GLuint m_iboID
the id of the index bufffer object
a class to store an OpenGL VAO
Real * getDataPointer(unsigned int _vbo, GLenum _accessMode=GL_READ_WRITE)
grab a pointer to the first block of the data
void bind()
bind this VOA to make it active
GLenum m_indexType
Specifies the type of the values in the indices buffer. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.
GLAPI void GLAPIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)