forked from MarkusBansky/socialTree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVBORender.h
70 lines (51 loc) · 1.47 KB
/
VBORender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef VBORENDER_H
#define VBORENDER_H
#include <vector>
#include <QtGlobal>
#include <QGLFunctions>
#include <QGLShaderProgram>
#include "RenderTypes.h"
struct VBOBuffer
{
uint id;
uint mode;
uint textureIndex;
size_t start_id, count;
};
typedef std::vector<VBOBuffer> VBOBuffers;
class VBORender : protected QGLFunctions
{
public:
VBORender();
virtual ~VBORender();
void vertexAdd(float x, float y, float z);
void vertexAdd(const Vertex2F& pos, float z);
void drawStart(uint mode);
void drawStop();
void textureEnable();
void textureDisable();
void textureSelect(uint index);
void setColor(float r, float g, float b, float a);
void setTextureCoordinates(float s, float t);
void setTextureCoordinates(const Vertex2F& pos);
void genVBO(size_t from, size_t to);
void genVBOs();
void registerVBOs();
void drawVBOs(QGLShaderProgram* program);
void clearVBOs();
void clearBuffers();
void init();
protected:
private:
ModeBuffer modeBuffer_;
VertexBuffer vertexBuffer_;
ColorBuffer colorBuffer_;
TextureIndexBuffer textureIndBuffer_;
TextureCoordinatesBuffer textureCoordBuffer_;
VBOBuffers subBuffers_;
TextureCoordinates currentTextureCoord_;
uint currentMode_;
Color currentColor_;
uint currentTexture_;
};
#endif // VBORENDER_H