xoreos  0.0.5
indexbuffer.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef GRAPHICS_INDEXBUFFER_H
26 #define GRAPHICS_INDEXBUFFER_H
27 
28 #include "src/graphics/types.h"
29 
30 namespace Graphics {
31 
33 class IndexBuffer {
34 public:
35  IndexBuffer();
36 
37  IndexBuffer(const IndexBuffer &other);
38 
39  ~IndexBuffer();
40 
41  IndexBuffer &operator=(const IndexBuffer &other);
42 
44  void setSize(uint32 indexCount, uint32 indexSize, GLenum indexType);
45 
47  GLvoid *getData();
48 
50  const GLvoid *getData() const;
51 
53  uint32 getCount() const;
54 
56  GLenum getType() const;
57 
59  void initGL(GLuint hint = GL_STATIC_DRAW);
60 
62  void updateGL();
63 
65  void destroyGL();
66 
67  GLuint getIBO() const;
68 
69 private:
72  GLenum _type;
74 
75  GLuint _ibo;
76  GLuint _hint;
77 };
78 
79 } // End of namespace Graphics
80 
81 #endif // GRAPHICS_INDEXBUFFER_H
GLvoid * getData()
Access buffer data.
Definition: indexbuffer.cpp:78
void destroyGL()
Clear (destroy) GL resources associated with the buffer.
Basic graphics types.
GLuint _ibo
"Index" Buffer Object.
Definition: indexbuffer.h:75
void updateGL()
Update existing GL buffer object.
GLuint _hint
GL hint for static or dynamic data.
Definition: indexbuffer.h:76
uint32 _count
Number of elements in buffer.
Definition: indexbuffer.h:70
void initGL(GLuint hint=GL_STATIC_DRAW)
Initialise internal buffer object for GL handling.
Definition: indexbuffer.cpp:94
byte * _data
Buffer data.
Definition: indexbuffer.h:73
GLenum getType() const
Get element type.
Definition: indexbuffer.cpp:90
uint32 getCount() const
Get element count.
Definition: indexbuffer.cpp:86
uint32 _size
Size of a buffer element in bytes.
Definition: indexbuffer.h:71
uint32_t uint32
Definition: types.h:204
Buffer containing indices data.
Definition: indexbuffer.h:33
GLuint getIBO() const
void setSize(uint32 indexCount, uint32 indexSize, GLenum indexType)
Change buffer size.
Definition: indexbuffer.cpp:65
uint8 byte
Definition: types.h:209
GLenum _type
Element type (GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, ...).
Definition: indexbuffer.h:72
IndexBuffer & operator=(const IndexBuffer &other)
Definition: indexbuffer.cpp:44