NGL  6.5
The NCCA Graphics Library
AbstractVAO.cpp
Go to the documentation of this file.
1 #include "AbstractVAO.h"
2 #include <iostream>
3 namespace ngl
4 {
6  {
7  // first we create a vertex array Object
9  m_mode=_mode;
10  }
11 
13  {
14  return m_mode;
15  }
16 
17  void AbstractVAO::setMode(const GLenum &_mode)
18  {
19  m_mode = _mode;
20  }
21 
22  //----------------------------------------------------------------------------------------------------------------------
24  {
26  m_bound=true;
27  }
28  //----------------------------------------------------------------------------------------------------------------------
30  {
32  m_bound=false;
33  }
34 
35 
36  void AbstractVAO::setVertexAttributePointer(GLuint _id, GLint _size, GLenum _type, GLsizei _stride, unsigned int _dataOffset, bool _normalise )
37  {
38  if(m_bound !=true)
39  {
40  std::cerr<<"Warning trying to set attribute on Unbound VOA\n";
41  }
42  // set and enable the generic vertex attribute
43  glVertexAttribPointer(_id,_size,_type,_normalise,_stride,static_cast<Real *>(NULL) + _dataOffset);// ((Real *)NULL + (_dataOffset)));
45  }
46 
47 }
#define glGenVertexArrays
Definition: glew.h:7447
#define glVertexAttribPointer
Definition: glew.h:2002
unsigned int GLuint
Definition: glew.h:280
#define glEnableVertexAttribArray
Definition: glew.h:1921
unsigned int GLenum
Definition: glew.h:278
implementation files for RibExport class
Definition: AABB.cpp:22
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 occasi...
Definition: AbstractVAO.cpp:36
#define glBindVertexArray
Definition: glew.h:7445
GLenum getMode() const
get the draw mode
Definition: AbstractVAO.cpp:12
GLenum m_mode
the draw mode
Definition: AbstractVAO.h:117
bool m_bound
debug flag to indicate if the vao is bound.
Definition: AbstractVAO.h:125
void setMode(const GLenum &_mode)
set the draw mode
Definition: AbstractVAO.cpp:17
GLuint m_id
the id of the VAO allocated from OpenGL
Definition: AbstractVAO.h:121
void unbind()
unbind the VAO by binding default 0
Definition: AbstractVAO.cpp:29
void bind()
bind the VAO so it can be used.
Definition: AbstractVAO.cpp:23
int GLint
Definition: glew.h:281
int GLsizei
Definition: glew.h:282
AbstractVAO(GLenum _mode=GL_TRIANGLES)
Definition: AbstractVAO.cpp:5