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>
This commit is contained in:
parent
f35797991e
commit
101a6bda45
@ -856,16 +856,11 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current()
|
|||||||
{
|
{
|
||||||
QWindowsOpenGLContextFormat result;
|
QWindowsOpenGLContextFormat result;
|
||||||
const QByteArray version = QOpenGLStaticContext::getGlString(GL_VERSION);
|
const QByteArray version = QOpenGLStaticContext::getGlString(GL_VERSION);
|
||||||
const int majorDot = version.indexOf('.');
|
int major, minor;
|
||||||
if (majorDot != -1) {
|
if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor))
|
||||||
int minorDot = version.indexOf('.', majorDot + 1);
|
result.version = (major << 8) + minor;
|
||||||
if (minorDot == -1)
|
else
|
||||||
minorDot = version.size();
|
|
||||||
result.version = (version.mid(0, majorDot).toInt() << 8)
|
|
||||||
+ version.mid(majorDot + 1, minorDot - majorDot - 1).toInt();
|
|
||||||
} else {
|
|
||||||
result.version = 0x0200;
|
result.version = 0x0200;
|
||||||
}
|
|
||||||
result.profile = QSurfaceFormat::NoProfile;
|
result.profile = QSurfaceFormat::NoProfile;
|
||||||
if (result.version < 0x0300) {
|
if (result.version < 0x0300) {
|
||||||
result.options |= QSurfaceFormat::DeprecatedFunctions;
|
result.options |= QSurfaceFormat::DeprecatedFunctions;
|
||||||
|
Loading…
Reference in New Issue
Block a user