From 5b74536ac102ea8c051c77f6ff0869395bde54ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferenc=20G=C3=A9czi?= Date: Sat, 8 Jul 2023 10:00:03 +0000 Subject: [PATCH] [qt] Take the correct path depending on GL version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ferenc Géczi --- qt/qt_common/map_widget.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/qt/qt_common/map_widget.cpp b/qt/qt_common/map_widget.cpp index a3c26c2549..e18a09eaf9 100644 --- a/qt/qt_common/map_widget.cpp +++ b/qt/qt_common/map_widget.cpp @@ -383,8 +383,21 @@ void MapWidget::initializeGL() else { LOG(LINFO, ("Contex is LibGL")); - // TODO: Separate apiOpenGL3 from apiOpenGLES3, and use that for the currend shader code. - m_apiOpenGLES3 = true; + GLint majorVersion = 0, minorVersion = 0; + funcs->glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); + funcs->glGetIntegerv(GL_MINOR_VERSION, &minorVersion); + + if (majorVersion < 3 || (majorVersion == 3 && minorVersion < 2)) + { + LOG(LINFO, ("OpenGL version is below 3.2, taking the OpenGL 2.1 path")); + m_apiOpenGLES3 = false; + } + else + { + LOG(LINFO, ("OpenGL version is at least 3.2, enabling GLSL '#version 150 core'")); + // TODO: Separate apiOpenGL3 from apiOpenGLES3, and use that for the currend shader code. + m_apiOpenGLES3 = true; + } } auto fmt = context()->format();