QML application fails to start when QT_OPENGL=desktop set
-
A QML app which had been working fine on Windows starting failing to start for a user. The window was popping up blank briefly before closing. This is typical of some sort of OpenGL support issue in my experience so I asked him to try with QT_QUICK_BACKEND=software and sure enough that worked.
After I asked whether anything might have changed that could have affected graphics, it transpired that he had been told to set QT_OPENGL=desktop to allow a different Qt-based application (a Qt Widgets app that incorporates an OpenGL-based graphics viewer) to run. If he unset this variable, the QML application runs without the QT_QUICK_BACKEND setting.
I'm not familiar with this QT_OPENGL setting so I don't know what the implications are. Does anyone have any idea what might be going on, why it might be needed for a Qt Widgets app but prevents a QML app from running etc?
-
Hi,
If memory serves well, the Windows backend switches dynamically at start up between different implementation based on what it detects on the machine. Forcing it to OpenGL means that it disables the possibility to load the ANGLE backend which seems to be what your application is using.
-
@SGaist Thank you. This concurs with what I have since found out.
I got him to run the QML GUI with QSG_INFO=1, both with the QT_OPENGL setting and without.
When QT_OPENGL is not set, it is using ANGLE:
Debug: GL_VENDOR: Google Inc. Debug: GL_RENDERER: ANGLE (Microsoft Basic Render Driver Direct3D11 vs_5_0 ps_5_0) Debug: GL_VERSION: OpenGL ES 2.0 (ANGLE 2.1.0.8613f4946861)
When QT_OPENGL is set, it just tries to use basic generic GL which is not sufficient for QML:
Debug: GL_VENDOR: Microsoft Corporation Debug: GL_RENDERER: GDI Generic Debug: GL_VERSION: 1.1.0
I am tempted to fix my application's startup script to filter out any setting of QT_OPENGL. I don't know if that could cause other problems down the line though...
-
The idea behind the dynamic backend is to be able to detect what is available. From the looks of it there's an issue with the driver on that machine.
In any case, forcing the backend to desktop for all Qt applications on a system is wrong. It should be done on an application basis.