Qt 6 has removed the support for ANGLE for their OpenGL backend. Now I would still like to use ANGLE with Qt because I would like to run custom OpenGL code that is translated by ANGLE to Vulkan Linux and Direct3D on Windows. I've tried to use ANGLE in my Qt 6 application, but without success. What I have tried is:
Build ANGLE from source files (on Linux) as per instructions (ANGLE build instructions).
Copied the generated libGLESv2.so and libEGL.so files into application directory. Then in my CMakeFiles.txt I have added:
find_library(libGLESv2 GLESv2)
find_library(libEGL EGL)
target_link_libraries(MyApp PRIVATE ${libGLESv2} ${libEGL})
Then in my main file I have added
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
My project links and builds fine, but the ANGLE backend seems to have no effect. It appears that Qt is still using the standard OpenGL implementation rather than the one provided by ANGLE (running QOpenGLContext::currentContext()->hasExtension("EGL_ANGLE_platform_angle")
returns false when I set up my context).
Using QT_LOGGING_RULES=qt.qpa.gl=true,the logs show:
qt.qpa.gl: Choosing xcb gl-integration based on following priority ("xcb_glx", "xcb_egl") qt.qpa.gl: Xcb GLX gl-integration created qt.qpa.gl: Xcb GLX gl-integration successfully initialized qt.qpa.gl: Requested format before FBConfig/Visual selection: QSurfaceFormat(version 3.0, options QFlagsQSurfaceFormat::FormatOption(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile)
How can I correctly setup Qt to rely on ANGLE?