diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2009-10-01 05:49:32 (GMT) |
---|---|---|
committer | Sarah Smith <sarah.j.smith@nokia.com> | 2009-10-01 05:49:32 (GMT) |
commit | 059d40d3f918f658041ec20ba04f9d010cfc0fa7 (patch) | |
tree | 35e5d01fdbfdd941495e7955e538954ce9a00ac4 /examples/opengl/pbuffers/glwidget.h | |
parent | 5496fbd5f4e5f272ba4f8150c909206ad409fd1d (diff) | |
download | Qt-059d40d3f918f658041ec20ba04f9d010cfc0fa7.zip Qt-059d40d3f918f658041ec20ba04f9d010cfc0fa7.tar.gz Qt-059d40d3f918f658041ec20ba04f9d010cfc0fa7.tar.bz2 |
Remove display lists and refactor ready for ES/ES2 port
Display lists, and a few other features dont work in ES/ES2. Refaoctor to
allow redo of lighting and other non-fixed-function pipeline features.
Also use QAnimation* classes instead of timers, and correct a few minor
bugs (flipped texture). Include new screenshot (old one manifested bug).
Reviewed-by: Rhys Weatherley
Diffstat (limited to 'examples/opengl/pbuffers/glwidget.h')
-rw-r--r-- | examples/opengl/pbuffers/glwidget.h | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h index 5b64b08..991e8b9 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 |