summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2016-01-19 12:53:24 +1100
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2016-01-19 10:09:59 +0000
commitc7752afb91f2aa7038a65c3c8eb58a5195b357b7 (patch)
treeeb9f593239be29f30f89d8ec0574cb5ee23e5fe4 /src
parent193f685cf83646f0ba978bd40e554a06e27772d4 (diff)
Only use OpenGL ES2 for Mesa on Windows
Mesa is used on Linux desktops for open source graphics drivers which support more than OpenGL ES2. This fixes the volumetric example not rendering correctly when using the open source ATI graphics driver. Change-Id: Ibf4df6cc84881a15464653b65d1221b20c853b19 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/datavisualization/utils/qutils.h5
-rw-r--r--src/datavisualization/utils/utils.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/datavisualization/utils/qutils.h b/src/datavisualization/utils/qutils.h
index 2ff0979d..0b7930b6 100644
--- a/src/datavisualization/utils/qutils.h
+++ b/src/datavisualization/utils/qutils.h
@@ -73,8 +73,11 @@ static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// We support only ES2 emulation with software renderer for now
+ QString versionStr;
+#ifdef Q_OS_WIN
const GLubyte *openGLVersion = ctx->functions()->glGetString(GL_VERSION);
- QString versionStr = QString::fromLatin1(reinterpret_cast<const char *>(openGLVersion)).toLower();
+ versionStr = QString::fromLatin1(reinterpret_cast<const char *>(openGLVersion)).toLower();
+#endif
if (versionStr.contains(QStringLiteral("mesa"))
|| QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) {
qWarning("Only OpenGL ES2 emulation is available for software rendering.");
diff --git a/src/datavisualization/utils/utils.cpp b/src/datavisualization/utils/utils.cpp
index 47b584c1..df8552b4 100644
--- a/src/datavisualization/utils/utils.cpp
+++ b/src/datavisualization/utils/utils.cpp
@@ -362,8 +362,11 @@ void Utils::resolveStatics()
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// We support only ES2 emulation with software renderer for now
+ QString versionStr;
+#ifdef Q_OS_WIN
const GLubyte *openGLVersion = ctx->functions()->glGetString(GL_VERSION);
- QString versionStr = QString::fromLatin1((const char *)openGLVersion).toLower();
+ versionStr = QString::fromLatin1(reinterpret_cast<const char *>(openGLVersion)).toLower();
+#endif
if (versionStr.contains(QStringLiteral("mesa"))
|| QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) {
qWarning("Only OpenGL ES2 emulation is available for software rendering.");