diff options
author | Tomi Korpipää <tomi.korpipaa@qt.io> | 2016-11-17 07:21:18 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2016-11-17 09:13:09 +0000 |
commit | b3fed1c9b2a1720ab33afbb6ba44b5eadc39e25a (patch) | |
tree | 6d68082d750339ebc4eecf672f73f514ed04f5f1 /src | |
parent | 0d4096ab9d7785d05da7f3174070f0b5e91306d9 (diff) |
Check if we got OpenGL2.1 functions before trying to use them
Change-Id: Ia8b4a25094d4a608d3a20b808fd14c3941ae2dff
Task-number: QTRD-2116
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/datavisualization/engine/abstract3drenderer.cpp | 6 | ||||
-rw-r--r-- | src/datavisualization/utils/texturehelper.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index ecef2598..4a681554 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -134,10 +134,14 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller) QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs); m_funcs_2_1 = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_2_1>(); - m_funcs_2_1->initializeOpenGLFunctions(); + if (m_funcs_2_1) + m_funcs_2_1->initializeOpenGLFunctions(); // Restore original message handler qInstallMessageHandler(handler); + + if (!m_funcs_2_1) + qFatal("OpenGL version is too low, at least 2.1 is required"); } #endif QObject::connect(m_drawer, &Drawer::drawerChanged, this, &Abstract3DRenderer::updateTextures); diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp index 7a5098c4..fb7b099a 100644 --- a/src/datavisualization/utils/texturehelper.cpp +++ b/src/datavisualization/utils/texturehelper.cpp @@ -49,10 +49,14 @@ TextureHelper::TextureHelper() m_openGlFunctions_2_1 = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_2_1>(); - m_openGlFunctions_2_1->initializeOpenGLFunctions(); + if (m_openGlFunctions_2_1) + m_openGlFunctions_2_1->initializeOpenGLFunctions(); // Restore original message handler qInstallMessageHandler(handler); + + if (!m_openGlFunctions_2_1) + qFatal("OpenGL version is too low, at least 2.1 is required"); } #endif } |