summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellowindow/hellowindow.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl/hellowindow/hellowindow.h')
-rw-r--r--examples/opengl/hellowindow/hellowindow.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h
index 3d6ac80cfe..6d66f0204a 100644
--- a/examples/opengl/hellowindow/hellowindow.h
+++ b/examples/opengl/hellowindow/hellowindow.h
@@ -41,10 +41,13 @@
#include <QWindow>
#include <QColor>
+#include <QMutex>
#include <QOpenGLShaderProgram>
#include <QSharedPointer>
#include <QTimer>
+class HelloWindow;
+
class Renderer : public QObject
{
Q_OBJECT
@@ -54,8 +57,10 @@ public:
QSurfaceFormat format() const { return m_format; }
-public slots:
- void render(QSurface *surface, const QColor &color, const QSize &viewSize);
+ void setAnimating(HelloWindow *window, bool animating);
+
+private slots:
+ void render();
private:
void initialize();
@@ -78,30 +83,28 @@ private:
QSurfaceFormat m_format;
QOpenGLContext *m_context;
QOpenGLShaderProgram *m_program;
+
+ QList<HelloWindow *> m_windows;
+ int m_currentWindow;
+
+ QMutex m_windowLock;
};
class HelloWindow : public QWindow
{
- Q_OBJECT
-
public:
explicit HelloWindow(const QSharedPointer<Renderer> &renderer);
+ QColor color() const;
void updateColor();
void exposeEvent(QExposeEvent *event);
-signals:
- void needRender(QSurface *surface, const QColor &color, const QSize &viewSize);
-
-private slots:
- void render();
-
private:
void mousePressEvent(QMouseEvent *);
int m_colorIndex;
QColor m_color;
const QSharedPointer<Renderer> m_renderer;
- QTimer *m_timer;
+ mutable QMutex m_colorLock;
};