mirror of https://github.com/qt/qtdatavis3d.git
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>
This commit is contained in:
parent
0d4096ab9d
commit
b3fed1c9b2
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue