diff options
| author | Samuel Rødal <[email protected]> | 2011-08-18 10:50:18 +0200 |
|---|---|---|
| committer | Paul Olav Tvete <[email protected]> | 2011-08-19 13:57:30 +0200 |
| commit | 66d9b4d2f843205e56550e631d82184d20f7038e (patch) | |
| tree | 9a22bfb729bfc3d9e4f4d09cc6ff0bd80d493468 /examples/opengl/hellowindow/hellowindow.h | |
| parent | 9db6c348df79729ebba5069ccd5e5cb960da4000 (diff) | |
Make the hellowindow example multi-threaded to stress the GL backend.
Change-Id: I9e158c0889b050f9ed76ea21176102fc792eef83
Reviewed-on: http://codereview.qt.nokia.com/3150
Reviewed-by: Qt Sanity Bot <[email protected]>
Reviewed-by: Paul Olav Tvete <[email protected]>
Diffstat (limited to 'examples/opengl/hellowindow/hellowindow.h')
| -rw-r--r-- | examples/opengl/hellowindow/hellowindow.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index 3c5388cb76a..c114b09a246 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -2,6 +2,7 @@ #include <QtOpenGL/qgl.h> #include <QtOpenGL/qglshaderprogram.h> +#include <QtOpenGL/qglframebufferobject.h> #include <QTime> @@ -9,11 +10,13 @@ class QGuiGLContext; class Renderer : public QObject { + Q_OBJECT public: - Renderer(); + Renderer(const QSurfaceFormat &format, Renderer *share = 0); - QSurfaceFormat format() const; + QSurfaceFormat format() const { return m_format; } +public slots: void render(QSurface *surface, const QColor &color, const QSize &viewSize); private: @@ -45,14 +48,16 @@ class HelloWindow : public QWindow public: HelloWindow(Renderer *renderer); + void updateColor(); + +signals: + void needRender(QSurface *surface, const QColor &color, const QSize &viewSize); + private slots: void render(); -protected: - void mousePressEvent(QMouseEvent *); - private: - void updateColor(); + void mousePressEvent(QMouseEvent *); int m_colorIndex; QColor m_color; |
