diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-06 18:56:01 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-18 16:09:55 +0200 |
commit | 3475b5f3a80545dfbd4746295e8e1ae88c7114ca (patch) | |
tree | 0e3e14ae5cd4708a76beaf522eb9f7214ce5d8fd /examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h | |
parent | 1c5de027d0c31d1d6697bd0557128d92207763d8 (diff) |
Modernize the rendercontrol_opengl example
Make it work when using QRhi-on-OpenGL.
Some features like demonstrating a dedicated render thread, or targeting
the window with the Quick content ('onscreen' argument, not clear why
that was added in the first place), are now removed. Some of these could
be reintroduced in future examples, not necessarily in combination with
OpenGL. For now they are removed since the cost of porting and
maintaining all that is not reasonable at this point.
Task-number: QTBUG-84040
Change-Id: I67e5c7cc835c5cf5653cf827004ce66a4d300b36
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h')
-rw-r--r-- | examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h index 44b79d9f51..ad53d5c8a5 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.h @@ -55,14 +55,16 @@ #include <QMatrix4x4> #include <QTimer> -QT_FORWARD_DECLARE_CLASS(QOpenGLContext) -QT_FORWARD_DECLARE_CLASS(QOpenGLFramebufferObject) -QT_FORWARD_DECLARE_CLASS(QOffscreenSurface) -QT_FORWARD_DECLARE_CLASS(QQuickRenderControl) -QT_FORWARD_DECLARE_CLASS(QQuickWindow) -QT_FORWARD_DECLARE_CLASS(QQmlEngine) -QT_FORWARD_DECLARE_CLASS(QQmlComponent) -QT_FORWARD_DECLARE_CLASS(QQuickItem) +QT_BEGIN_NAMESPACE +class QOpenGLContext; +class QOpenGLTexture; +class QOffscreenSurface; +class QQuickRenderControl; +class QQuickWindow; +class QQmlEngine; +class QQmlComponent; +class QQuickItem; +QT_END_NAMESPACE class CubeRenderer; @@ -83,8 +85,8 @@ protected: private slots: void run(); - void createFbo(); - void destroyFbo(); + void createTexture(); + void destroyTexture(); void render(); void requestUpdate(); void handleScreenChange(); @@ -92,7 +94,7 @@ private slots: private: void startQuick(const QString &filename); void updateSizes(); - void resizeFbo(); + void resizeTexture(); QOpenGLContext *m_context; QOffscreenSurface *m_offscreenSurface; @@ -101,14 +103,13 @@ private: QQmlEngine *m_qmlEngine; QQmlComponent *m_qmlComponent; QQuickItem *m_rootItem; - QOpenGLFramebufferObject *m_fbo; + uint m_textureId; + QSize m_textureSize; bool m_quickInitialized; bool m_quickReady; QTimer m_updateTimer; CubeRenderer *m_cubeRenderer; qreal m_dpr; - bool m_onscreen; - QSize m_onscreenSize; }; #endif |