-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenGLHelpers.h
61 lines (47 loc) · 1.24 KB
/
OpenGLHelpers.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
#ifndef _OPENGL_HELPERS_H_
#define _OPENGL_HELPERS_H_
#include <ma.h>
#include <IX_WIDGET.h>
#include <GLES/gl.h>
#include "vec.h"
#include <MAUtil/Vector.h>
void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);
void resizeWindow(int x, int y, int width, int height, float fov=90.0f);
void initGL();
void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
GLfloat centerx, GLfloat centery, GLfloat centerz,
GLfloat upx, GLfloat upy, GLfloat upz);
GLuint initTexture(MAHandle image);
class TriangleStripVBO
{
public:
struct TriangleStrip {
TriangleStrip()
{
}
MAUtil::Vector<vec3> vertices;
MAUtil::Vector<vec2> textureCoordinates;
};
void initVBO(const MAUtil::Vector<TriangleStrip>& strips);
void renderVBO();
protected:
struct TriangleStripInfo
{
TriangleStripInfo()
{
}
TriangleStripInfo(int vertexCoordOffset, int textureCoordOffset, int numVertices) :
vertexCoordOffset(vertexCoordOffset), textureCoordOffset(textureCoordOffset), numVertices(numVertices)
{
}
int vertexCoordOffset;
int textureCoordOffset;
int numVertices;
};
MAUtil::Vector<TriangleStripInfo> mTriangleStrips;
GLuint mVBO;
int mVerticesOffset;
int mTextureCoordOffset;
int mNumVertices;
};
#endif