summaryrefslogtreecommitdiffstats
path: root/examples/opengl/cube/mainwidget.h
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-05-11 17:35:46 +0200
committerDavid Boddie <david.boddie@nokia.com>2011-05-23 14:24:07 +0200
commit0cbcc61ef35b9bce1d65d048853c79004b755b87 (patch)
tree0e10f00827d9d3b84862e371d163f1b2774ee996 /examples/opengl/cube/mainwidget.h
parent0748751c9f097d9d866605306bbdd4b96e2a5c4e (diff)
Squashed commit of changes from the 4.8-temp branch.
Diffstat (limited to 'examples/opengl/cube/mainwidget.h')
-rw-r--r--examples/opengl/cube/mainwidget.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h
new file mode 100644
index 0000000000..595173b65d
--- /dev/null
+++ b/examples/opengl/cube/mainwidget.h
@@ -0,0 +1,53 @@
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include <QtOpenGL/QGLWidget>
+
+#include <QMatrix4x4>
+#include <QQuaternion>
+#include <QVector2D>
+
+class QBasicTimer;
+class QGLShaderProgram;
+
+class GeometryEngine;
+
+class MainWidget : public QGLWidget
+{
+ Q_OBJECT
+public:
+ explicit MainWidget(QWidget *parent = 0);
+ virtual ~MainWidget();
+
+signals:
+
+public slots:
+
+protected:
+ void mousePressEvent(QMouseEvent *e);
+ void mouseReleaseEvent(QMouseEvent *e);
+ void timerEvent(QTimerEvent *e);
+
+ void initializeGL();
+ void resizeGL(int w, int h);
+ void paintGL();
+
+ void initShaders();
+ void initTextures();
+
+private:
+ QBasicTimer *timer;
+ QGLShaderProgram *program;
+ GeometryEngine *geometries;
+
+ GLuint texture;
+
+ QMatrix4x4 projection;
+
+ QVector2D mousePressPosition;
+ QVector3D rotationAxis;
+ qreal angularSpeed;
+ QQuaternion rotation;
+};
+
+#endif // MAINWIDGET_H