summaryrefslogtreecommitdiffstats
path: root/examples/opengl/pbuffers/glwidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl/pbuffers/glwidget.h')
-rw-r--r--examples/opengl/pbuffers/glwidget.h43
1 files changed, 30 insertions, 13 deletions
diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h
index 5b64b08b5c..991e8b9692 100644
--- a/examples/opengl/pbuffers/glwidget.h
+++ b/examples/opengl/pbuffers/glwidget.h
@@ -39,32 +39,49 @@
**
****************************************************************************/
-#include <QtOpenGL>
+#ifndef GLWIDGET_H
+#define GLWIDGET_H
+
+#include <QGLWidget>
+
+class Geometry;
+class Cube;
+class Tile;
class GLWidget : public QGLWidget
{
public:
- GLWidget(QWidget *parent);
+ GLWidget(QWidget *parent = 0);
~GLWidget();
+
+protected:
void initializeGL();
- void resizeGL(int w, int h);
void paintGL();
- void timerEvent(QTimerEvent *) { update(); }
- void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
- void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
+ void resizeGL(int width, int height);
+ void mousePressEvent(QMouseEvent *) { setAnimationPaused(true); }
+ void mouseReleaseEvent(QMouseEvent *) { setAnimationPaused(false); }
- void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
- void initCommon();
+private:
+ void initializeGeometry();
void initPbuffer();
+ void initCommon();
+ void perspectiveProjection();
+ void orthographicProjection();
+ void drawPbuffer();
+ void setAnimationPaused(bool enable);
-private:
- GLfloat rot[3], xOffs[3], yOffs[3], xInc[3];
- GLuint pbufferList;
+ qreal aspect;
GLuint dynamicTexture;
GLuint cubeTexture;
- int timerId;
bool hasDynamicTextureUpdate;
-
QGLPixelBuffer *pbuffer;
+ Geometry *geom;
+ Cube *cube;
+ Tile *backdrop;
+ QList<Cube *> cubes;
+ QList<Tile *> tiles;
+
};
+//! [3]
+#endif