]> git.tdb.fi Git - libs/gl.git/blob - source/immediate.h
Generalize VertexBuffer into Buffer with support for other types as well
[libs/gl.git] / source / immediate.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_IMMEDIATE_H_
9 #define MSP_GL_IMMEDIATE_H_
10
11 #include "primitivebuilder.h"
12
13 namespace Msp {
14 namespace GL {
15
16 /**
17 Draws primitives on the screen.  This works similarly to the OpenGL immediate
18 mode: call begin() to start a batch of primitives, specify vertices, and call
19 end() to terminate the batch.  However, unlike OpenGL immediate mode, vertices
20 are not drawn as they are specified.  Instead, they are accumulated in a
21 VertexArray and drawn when end() is called.
22 */
23 class Immediate: public PrimitiveBuilder
24 {
25 private:
26         VertexArray array;
27         std::vector<unsigned> indices;
28
29 public:
30         Immediate(VertexFormat);
31         void reset();
32 private:
33         virtual void begin_() { }
34         virtual void end_();
35         virtual void element_(unsigned);
36 };
37
38 } // namespace GL
39 } // namespace Msp
40
41 #endif