Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.2
-
None
-
-
7c74048e94257c5cdc367c3144dc0e26adf06a56 (qt/qtbase/5.12)
Description
Under desktop linux, when using "xcb_egl" connection, request for OpenGL ES context failed(It works well when using GLX).
setenv("QT_XCB_GL_INTEGRATION", "xcb_egl", 1)
surf_format.setRenderableType(QSurfaceFormat::OpenGLES)
QOpenGLContext* glctx = new OpenGLContext;
glctx->setFormat(surf_format);
glctx->create();
assert(glctx->isOpenGLES());
The reason is in QEglConfigChooser::chooseConfig(), eglChooseConfig() is called to select compatible config, and EGL will set EGL_RENDERABLE_TYPE attribute to all supported render type(under desktop, including OpenGL and OpenGL ES). Then OpenGL is always selected despite user asking for OES context.
The fix seems trivial, in QEGLPlatformContext::init(), just change
m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig);
to
m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig, format);
For the same reason, call QOpenGLContext::setNativeHandle() with an EGL OES context is also broken currently.
Please fix this, thanks!