-
Notifications
You must be signed in to change notification settings - Fork 0
/
OGLContext.h
47 lines (37 loc) · 961 Bytes
/
OGLContext.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
#ifndef OGLCONTEXT_H
#define OGLCONTEXT_H
#include <QGLWidget>
#include <QVector2D>
#include <QVector3D>
#include <QTimer>
class OGLContext : public QGLWidget
{
Q_OBJECT
QVector<QVector3D> vertices;
QVector<QVector2D> texCoords;
GLuint textures[4];
GLfloat nScale;
GLfloat ratio;
GLfloat xRot;
GLfloat yRot;
GLfloat zRot;
QPoint mousePosition;
bool qRotate;
QTimer *timer;
void rotateBy(int xAngle, int yAngle, int zAngle);
void makeObject();
private slots:
void rotateOneStep();
protected:
void initializeGL();
void resizeGL(int nWidth, int nHeight);
void paintGL();
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
public:
OGLContext(QWidget* parent = 0);
~OGLContext();
};
#endif // OGLCONTEXT_H