From 3e65d0408b830518ca2f18c8d0d583cbb665d1f3 Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Thu, 25 Mar 2021 12:07:23 +0800 Subject: [PATCH] Use QOpenGLContext::openGLModuleType() instead of QT_CONFIG(opengles2) In the QOpenGLContext::openGLModuleType(), it will correctly judge QT_CONFIG(opengles2), there is no need to use QT_CONFIG(opengles2) alone in QGLXContext. Change-Id: I012703b6a81b88fa4b8aa53cc1077c8b42d34ed5 Reviewed-by: Laszlo Agocs --- .../xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index b6cb54370a..81ece71f02 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -226,11 +226,8 @@ QGLXContext::QGLXContext(Display *display, QXcbScreen *screen, const QSurfaceFor , m_ownsContext(true) { if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType) -#if QT_CONFIG(opengles2) - m_format.setRenderableType(QSurfaceFormat::OpenGLES); -#else - m_format.setRenderableType(QSurfaceFormat::OpenGL); -#endif + m_format.setRenderableType(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL + ? QSurfaceFormat::OpenGL : QSurfaceFormat::OpenGLES); if (m_format.renderableType() != QSurfaceFormat::OpenGL && m_format.renderableType() != QSurfaceFormat::OpenGLES) return;