NGL  6.5
The NCCA Graphics Library
SimpleIndexVAO.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef SIMPLEINDEXVAO_H_
18 #define SIMPLEINDEXVAO_H_
19 
20 #include "AbstractVAO.h"
21 
22 namespace ngl
23 {
24 //----------------------------------------------------------------------------------------------------------------------
32 //----------------------------------------------------------------------------------------------------------------------
33 
35 {
36  public :
37 
39  {
40  public :
41  VertexData(size_t _size,const GLfloat &_data, unsigned int _indexSize,const GLvoid *_indexData,GLenum _indexType, GLenum _mode=GL_STATIC_DRAW ) :
42  AbstractVAO::VertexData(_size,_data,_mode),
43  m_indexSize(_indexSize), m_indexData(_indexData), m_indexType(_indexType){}
44 
45  unsigned int m_indexSize;
48 
49  };
50  //----------------------------------------------------------------------------------------------------------------------
54  //----------------------------------------------------------------------------------------------------------------------
55  static AbstractVAO *create(GLenum _mode=GL_TRIANGLES) { return new SimpleIndexVAO(_mode); }
56  //----------------------------------------------------------------------------------------------------------------------
58  //----------------------------------------------------------------------------------------------------------------------
59  virtual void draw() const;
60  //----------------------------------------------------------------------------------------------------------------------
62  //----------------------------------------------------------------------------------------------------------------------
63  virtual ~SimpleIndexVAO();
64  //----------------------------------------------------------------------------------------------------------------------
66  //----------------------------------------------------------------------------------------------------------------------
67  virtual void removeVAO();
68  //----------------------------------------------------------------------------------------------------------------------
78 
79  //----------------------------------------------------------------------------------------------------------------------
80  //void setData(size_t _size,const GLfloat &_data,unsigned int _indexSize,const GLvoid *_indexData,GLenum _indexType,GLenum _mode=GL_STATIC_DRAW);
81  virtual void setData(const AbstractVAO::VertexData &_data);
82  //----------------------------------------------------------------------------------------------------------------------
86  //----------------------------------------------------------------------------------------------------------------------
87  GLuint getBufferID(unsigned int ){return m_buffer;}
88 
89  protected :
90  //----------------------------------------------------------------------------------------------------------------------
92  //----------------------------------------------------------------------------------------------------------------------
94  {
95 
96  }
97 
98  private :
99  //----------------------------------------------------------------------------------------------------------------------
101  //----------------------------------------------------------------------------------------------------------------------
102  GLuint m_buffer=0;
103  //----------------------------------------------------------------------------------------------------------------------
105  //----------------------------------------------------------------------------------------------------------------------
107 
108 };
109 
110 
111 } // end namespace
112 
113 #endif
unsigned int GLuint
Definition: glew.h:280
void GLvoid
Definition: glew.h:293
#define GL_STATIC_DRAW
Definition: glew.h:1671
#define NGL_DLLEXPORT
Definition: Types.h:65
#define GL_TRIANGLES
Definition: glew.h:330
unsigned int GLenum
Definition: glew.h:278
implementation files for RibExport class
Definition: AABB.cpp:22
float GLfloat
Definition: glew.h:289
SimpleIndexVAO(GLenum _mode)
ctor calles parent ctor to allocate vao;
base class for all VAO from the VAOFactory this defines the base class type with simple draw / bind b...
Definition: AbstractVAO.h:34
GLenum m_indexType
data type of the index data (e.g. GL_UNSIGNED_INT)
Simple indexed vao using one buffer and float data see https://github.com/NCCA/VertexArrayObject/tree...
VertexData(size_t _size, const GLfloat &_data, unsigned int _indexSize, const GLvoid *_indexData, GLenum _indexType, GLenum _mode=GL_STATIC_DRAW)
static AbstractVAO * create(GLenum _mode=GL_TRIANGLES)
creator method for the factory
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 ...