aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-11 14:44:07 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-11 18:13:59 +0200
commitde455222834e6b123a813fcad1064ff7d1991fc1 (patch)
treef93efa871a9be9ecd14ca746f4d70991371bc105 /examples/quick
parent8603a0177ae1256a21fbeff2d9f0ca14f648449b (diff)
openglunderqml example: remove unnecessary resetOpenGLState call
Also request the OpenGL RHI backend explicitly, like all the other similar examples (d3d11underqml, and so on) do. Calling resetOpenGLState() in this example is pointless because it happens before returning from the custom rendering function, and the endExternalCommands() call achieves the same internally, i.e. the rhi will know that cached state cannot be used anymore. There are other valid uses cases for resetOpenGLState() but this example does not have those. Change-Id: Ifa7861b80c29c174d02cfe37fe8ef8eed7344195 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/scenegraph/openglunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp4
2 files changed, 2 insertions, 4 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/main.cpp b/examples/quick/scenegraph/openglunderqml/main.cpp
index 4ca8d05f1c..c151af179e 100644
--- a/examples/quick/scenegraph/openglunderqml/main.cpp
+++ b/examples/quick/scenegraph/openglunderqml/main.cpp
@@ -59,6 +59,8 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
+ QQuickWindow::setSceneGraphBackend(QSGRendererInterface::OpenGLRhi);
+
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/openglunderqml/main.qml"));
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index 1c4563baa5..d80309cbfb 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -202,10 +202,6 @@ void SquircleRenderer::paint()
m_program->disableAttributeArray(0);
m_program->release();
- // Not strictly needed for this example, but generally useful for when
- // mixing with raw OpenGL.
- m_window->resetOpenGLState();
-
m_window->endExternalCommands();
}
//! [5]