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>
This commit is contained in:
Laszlo Agocs 2020-06-11 14:44:07 +02:00
parent 8603a0177a
commit de45522283
2 changed files with 2 additions and 4 deletions

View File

@ -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"));

View File

@ -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]