summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-10-20 12:54:48 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-10-20 13:11:11 +0000
commit101a6bda4573237f0a31b1b947ea1af0fa7fb37c (patch)
treeeef69b1551df74f9a270f4f71e22d2c5a23964cc /src/plugins/platforms
parentf35797991ea450478f4703399a551ca85bde053d (diff)
Fix GL_VERSION parsing when using WGL
Unlike other platforms and the EGL path, this one tries to parse GL_VERSION on its own. Unfortunately it breaks for certain version strings: we cannot assume more than major.minor in the beginning and so looking for a second dot is wrong. For example, "2.1 Mesa 7.11-devel" is parsed as major "2", minor "1 Mesa 7" (result in 0), leading to a version of 2.0 instead of 2.1. To overcome this, use the common helper function in QPlatformOpenGLContext. Change-Id: I460f4276a3a06659b542e0c076ddc1ada3122907 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index a7c14ed2ac..e372acc747 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -856,16 +856,11 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current()
{
QWindowsOpenGLContextFormat result;
const QByteArray version = QOpenGLStaticContext::getGlString(GL_VERSION);
- const int majorDot = version.indexOf('.');
- if (majorDot != -1) {
- int minorDot = version.indexOf('.', majorDot + 1);
- if (minorDot == -1)
- minorDot = version.size();
- result.version = (version.mid(0, majorDot).toInt() << 8)
- + version.mid(majorDot + 1, minorDot - majorDot - 1).toInt();
- } else {
+ int major, minor;
+ if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor))
+ result.version = (major << 8) + minor;
+ else
result.version = 0x0200;
- }
result.profile = QSurfaceFormat::NoProfile;
if (result.version < 0x0300) {
result.options |= QSurfaceFormat::DeprecatedFunctions;