]> git.tdb.fi Git - libs/gl.git/blob - source/vertexsetup.h
466eed40659d3d61fa8c9a27b00520ac43849c73
[libs/gl.git] / source / vertexsetup.h
1 #ifndef MSP_GL_VERTEXSETUP_H_
2 #define MSP_GL_VERTEXSETUP_H_
3
4 #include "bindable.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class VertexArray;
10
11 /**
12 Combines a VertexArray with an index buffer.  This wraps OpenGL's vertex array
13 objects.  Intended for internal use.
14 */
15 class VertexSetup: public Bindable<VertexSetup>
16 {
17 private:
18         unsigned id;
19         mutable bool dirty;
20         const VertexArray *array;
21         const Buffer *index_buffer;
22
23 public:
24         VertexSetup();
25         ~VertexSetup();
26
27         void set_vertex_array(const VertexArray &);
28         void set_index_buffer(const Buffer &);
29         const Buffer *get_index_buffer() const { return index_buffer; }
30
31 private:
32         void update() const;
33
34 public:
35         void bind() const;
36         static void unbind();
37 };
38
39 } // namespace GL
40 } // namespace Msp
41
42 #endif