forked from torriem/QtAgOpenGPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglutils.h
53 lines (44 loc) · 1.54 KB
/
glutils.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
#ifndef GLUTILS_H
#define GLUTILS_H
#include <QOpenGLFunctions>
#include <QMatrix4x4>
#include <QColor>
#include <QOpenGLBuffer>
#include <QVector3D>
#include <QVector4D>
#include <QVector2D>
struct ColorVertex {
QVector3D vertex;
QVector4D color;
};
struct VertexTexcoord {
QVector3D vertex;
QVector2D texcoord;
};
//thinking about putting GL buffer drawing routines here
//like Draw box, etc. Do I put the shaders as module globals here?
void initializeShaders();
void destroyShaders();
//Simple wrapper to draw primitives using lists of Vec3 or QVector3Ds
//with a single color.
void glDrawArraysColor(QOpenGLFunctions *gl, QMatrix4x4 mvp,
GLenum operation, QColor &color,
QOpenGLBuffer &vertexBuffer, GLenum glType,
int count,
float pointSize=1.0f);
//Simple wrapper to draw primitives using lists of vec3s or QVector3Ds
//with a color per vertex. Buffer format is 7 values per vertice:
//x,y,z,r,g,b,a
void glDrawArraysColors(QOpenGLFunctions *gl, QMatrix4x4 mvp,
GLenum operation,
QOpenGLBuffer &vertexBuffer, GLenum glType,
int count,
float pointSize=1.0f);
//Buffer format is 5 values per vertice:
//x,y,z,texX,texY
void glDrawArraysTexture(QOpenGLFunctions *gl, QMatrix4x4 mvp,
GLenum operation,
QOpenGLBuffer &vertexBuffer, GLenum glType,
int count);
//draw arrays
#endif // GLUTILS_H