From 394249616cbb4c0861a032d33f846f85e2801677 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 27 Sep 2012 15:24:34 +0100 Subject: OpenGL: Don't request a context version higher than is supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function wglCreateContextAttribsARB will fail if we request a context version higher than is supported. We therefore upper-bound the requested version by the version of the static context. This results in context creation succeeding and having the closest possible match to the requested format. The xcb qpa plugin is modified to operate similarly to the windows plugin in that it now creates a "static" context which is used to limit the versions of contexts requested by the user. Change-Id: I277ad7cc82edfdf7b9d8502ad921c8175feb1a4a Reviewed-by: Samuel Rødal --- src/gui/kernel/qplatformopenglcontext.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui/kernel/qplatformopenglcontext.cpp') diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp index 8e6a9da5624..f2d6f6199c7 100644 --- a/src/gui/kernel/qplatformopenglcontext.cpp +++ b/src/gui/kernel/qplatformopenglcontext.cpp @@ -118,14 +118,14 @@ void QPlatformOpenGLContext::setContext(QOpenGLContext *context) d->context = context; } -bool QPlatformOpenGLContext::parseOpenGLVersion(const QString& versionString, int &major, int &minor) +bool QPlatformOpenGLContext::parseOpenGLVersion(const QByteArray &versionString, int &major, int &minor) { bool majorOk = false; bool minorOk = false; - QStringList parts = versionString.split(QLatin1Char(' ')); - if (versionString.startsWith(QLatin1String("OpenGL ES"))) { + QList parts = versionString.split(' '); + if (versionString.startsWith(QByteArrayLiteral("OpenGL ES"))) { if (parts.size() >= 3) { - QStringList versionParts = parts.at(2).split(QLatin1Char('.')); + QList versionParts = parts.at(2).split('.'); if (versionParts.size() >= 2) { major = versionParts.at(0).toInt(&majorOk); minor = versionParts.at(1).toInt(&minorOk); @@ -138,7 +138,7 @@ bool QPlatformOpenGLContext::parseOpenGLVersion(const QString& versionString, in } } else { // Not OpenGL ES, but regular OpenGL, the version numbers are first in the string - QStringList versionParts = parts.at(0).split(QLatin1Char('.')); + QList versionParts = parts.at(0).split('.'); if (versionParts.size() >= 2) { major = versionParts.at(0).toInt(&majorOk); minor = versionParts.at(1).toInt(&minorOk); -- cgit v1.2.3