summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformopenglcontext.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2012-09-27 15:24:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-03 17:22:03 +0200
commit394249616cbb4c0861a032d33f846f85e2801677 (patch)
treed1b7b2b44041be92bbc47f3419866a823ed381c6 /src/gui/kernel/qplatformopenglcontext.cpp
parent84100c9085ddc30368582d02a4229d44622f85e2 (diff)
OpenGL: Don't request a context version higher than is supported
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 <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui/kernel/qplatformopenglcontext.cpp')
-rw-r--r--src/gui/kernel/qplatformopenglcontext.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp
index 8e6a9da562..f2d6f6199c 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<QByteArray> parts = versionString.split(' ');
+ if (versionString.startsWith(QByteArrayLiteral("OpenGL ES"))) {
if (parts.size() >= 3) {
- QStringList versionParts = parts.at(2).split(QLatin1Char('.'));
+ QList<QByteArray> 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<QByteArray> versionParts = parts.at(0).split('.');
if (versionParts.size() >= 2) {
major = versionParts.at(0).toInt(&majorOk);
minor = versionParts.at(1).toInt(&minorOk);