diff options
Diffstat (limited to 'examples/opengl/hellowindow/hellowindow.h')
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.h | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index f0b8ee8b45..274dc9ca17 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -5,22 +5,19 @@ #include <QTime> -class HelloWindow : public QWindow +class QGuiGLContext; + +class Renderer : public QObject { - Q_OBJECT public: - HelloWindow(); + Renderer(); -protected: - void mousePressEvent(QMouseEvent *); - void resizeEvent(QResizeEvent *); + QGuiGLFormat format() const; -private slots: - void render(); + void render(QPlatformGLSurface *surface, const QColor &color, const QSize &viewSize); private: void initialize(); - void updateColor(); qreal m_fAngle; bool m_showBubbles; @@ -36,5 +33,28 @@ private: int normalAttr; int matrixUniform; int colorUniform; - uint colorIndex; + + bool m_initialized; + QGuiGLFormat m_format; + QGuiGLContext *m_context; +}; + +class HelloWindow : public QWindow +{ + Q_OBJECT +public: + HelloWindow(Renderer *renderer); + +private slots: + void render(); + +protected: + void mousePressEvent(QMouseEvent *); + +private: + void updateColor(); + + int m_colorIndex; + QColor m_color; + Renderer *m_renderer; }; |