aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 14:51:40 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:24:39 +0200
commit13374ceb165c44658aa97890c37b206859c9a31c (patch)
tree562362b196a459ee3449a5a1e60e5216a9dd6984 /examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
parentae47deba4c943c496412530a8d2a5a688ae12038 (diff)
parentb5d18be5a03406d0aac83856dd41e1525fd14a28 (diff)
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Diffstat (limited to 'examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc')
-rw-r--r--examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc41
1 files changed, 18 insertions, 23 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
index 3d4f4443e9..69a9d2ce4b 100644
--- a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
+++ b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
@@ -94,17 +94,18 @@
\snippet scenegraph/openglunderqml/squircle.cpp 3
- The default behavior of the scene graph is to clear the
- framebuffer before rendering. Since we render before the scene
- graph, we need to turn this clearing off. This means that we need
- to clear ourselves in the \c paint() function.
+ The default behavior of the scene graph is to clear the framebuffer before
+ rendering. This is fine since we will insert our own rendering code after
+ this clear is enqueued. Make sure however that we clear to the desired
+ color (black).
\snippet scenegraph/openglunderqml/squircle.cpp 9
- We use the \c sync() function to initialize the renderer and to
- copy the state in our item into the renderer. When the renderer is
- created, we also connect the \l QQuickWindow::beforeRendering() to
- the renderer's \c paint() slot.
+ We use the \c sync() function to initialize the renderer and to copy the
+ state in our item into the renderer. When the renderer is created, we also
+ connect the \l QQuickWindow::beforeRendering() and \l
+ QQuickWindow::beforeRenderPassRecording() to the renderer's \c init() and
+ \c paint() slots.
\note The \l QQuickWindow::beforeSynchronizing() signal is emitted
on the rendering thread while the GUI thread is blocked, so it is
@@ -112,8 +113,11 @@
\snippet scenegraph/openglunderqml/squircle.cpp 6
- In the \c cleanup() function we delete the renderer which in turn
- cleans up its own resources.
+ In the \c cleanup() function we delete the renderer which in turn cleans up
+ its own resources. This is complemented by reimplementing \l
+ QQuickWindow::releaseResources() since just connecting to the
+ sceneGraphInvalidated() signal is not sufficient on its own to handle all
+ cases.
\snippet scenegraph/openglunderqml/squircle.cpp 8
@@ -124,22 +128,13 @@
\snippet scenegraph/openglunderqml/squircle.cpp 4
- In the SquircleRenderer's \c paint() function we start by
- initializing the shader program. By initializing the shader
- program here, we make sure that the OpenGL context is bound and
- that we are on the correct thread.
+ In the SquircleRenderer's \c init() function we start by initializing the
+ shader program if not yet done. The OpenGL context is current on the thread
+ when the slot is invoked.
\snippet scenegraph/openglunderqml/squircle.cpp 5
- We use the shader program to draw the squircle. At the end of the
- \c paint function we release the program and disable the
- attributes we used so that the OpenGL context is in a "clean"
- state for the scene graph to pick it up.
-
- \note If tracking the changes in the OpenGL context's state is not
- feasible, one can use the function \l
- QQuickWindow::resetOpenGLState() which will reset all state that
- the scene graph relies on.
+ We use the shader program to draw the squircle in \c paint().
\snippet scenegraph/openglunderqml/main.cpp 1