]> git.tdb.fi Git - libs/gl.git/blob - source/immediate.h
Move VertexFormat and VertexArrayBuilder to their own files
[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 "primitivetype.h"
12 #include "vertexarray.h"
13 #include "vertexbuilder.h"
14
15 namespace Msp {
16 namespace GL {
17
18 /**
19 Draws primitives on the screen.  This works similarly to the OpenGL immediate
20 mode: call begin() to start a batch of primitives, specify vertices, and call
21 end() to terminate the batch.  However, unlike OpenGL immediate mode, vertices
22 are not drawn as they are specified.  Instead, they are accumulated in a
23 VertexArray and drawn when end() is called.
24 */
25 class Immediate: public VertexBuilder
26 {
27 public:
28         Immediate(VertexFormat);
29         void begin(PrimitiveType);
30         void end();
31 private:
32         VertexArray array;
33         RefPtr<VertexArrayBuilder> builder;
34         PrimitiveType type;
35         bool in_batch;
36         unsigned n_vertices;
37
38         virtual void vertex_(float, float, float, float);
39 };
40
41 } // namespace GL
42 } // namespace Msp
43
44 #endif