-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenGLExample.h
More file actions
82 lines (64 loc) · 1.81 KB
/
OpenGLExample.h
File metadata and controls
82 lines (64 loc) · 1.81 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
//-------------------------------------------------------
// Filename: OpenGLExample.h
//
// Description: A Qt5 opengl window
//
// Creator: Professor Corey McBride for MEEN 570 - Brigham Young University
//
// Creation Date: 10/10/16
//
// Owner: Corey McBride
//-------------------------------------------------------
#ifndef OPENGLEXAMPLE_H
#define OPENGLEXAMPLE_H
#include <QOpenGLWidget>
#include <QOpenGLShaderProgram>
#include <QOpenGLFunctions>
#include <QKeyEvent>
class MeshGeometry3D;
class OpenGLExample : public QOpenGLWidget, protected QOpenGLFunctions
{
public:
OpenGLExample( QWidget *parent=0 ); //constructor
~OpenGLExample(); //destructor
void load_data(std::vector<MeshGeometry3D*> all_geometry);
protected:
void initializeGL(void);
void resizeGL( int w, int h );
void paintGL();
void keyPressEvent( QKeyEvent *e);
void timerEvent(QTimerEvent*);
private:
QOpenGLShaderProgram mShaderProgram;
GLuint mProgramHandle;
GLuint mMVPMatrixUHandle;
GLuint mMVMatrixUHandle;
GLuint mLightPositionUHandle;
GLuint mColorAHandle;
GLuint mColorUHandle;
GLuint mPositionAHandle;
GLuint mNormalAHandle;
GLuint mVertexBufferHandle;
GLuint mIndexBufferHandle;
GLuint mNormalBufferHandle;
GLuint mColorBufferHandle;
int64_t mNumIndicies;
QMatrix4x4 mMVP;
QMatrix4x4 mMV;
QMatrix4x4 mProjectionMatrix;
QMatrix4x4 mViewMatrix;
QMatrix4x4 mRotate;
std::vector<GLfloat> mAll_verticies;
std::vector<GLuint> mAll_indicies;
std::vector<GLfloat> mAll_normals;
std::vector<GLfloat> mAll_colors;
bool data_loaded;
bool data_set;
int mWidth;
int mHeight;
QVector3D mLightPos;
GLfloat mMaxCoord;
int mTimerCount;
QVector3D mRotateAxis;
};
#endif // OPENGLEXAMPLE_H