1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0031375: Visualization, TKOpenGl - suppress warning on WebGL 1.0

Check for WebGL version in advance.
This commit is contained in:
kgv 2020-02-17 13:59:58 +03:00
parent cd43c08f2b
commit c64efd9e30

View File

@ -1044,8 +1044,23 @@ void OpenGl_Context::ReadGlVersion (Standard_Integer& theGlVerMajor,
theGlVerMajor = 0;
theGlVerMinor = 0;
#ifdef GL_MAJOR_VERSION
// available since OpenGL 3.0 and OpenGL 3.0 ES
bool toCheckVer3 = true;
#if defined(__EMSCRIPTEN__)
// WebGL 1.0 prints annoying invalid enumeration warnings to console.
toCheckVer3 = false;
if (EMSCRIPTEN_WEBGL_CONTEXT_HANDLE aWebGlCtx = emscripten_webgl_get_current_context())
{
EmscriptenWebGLContextAttributes anAttribs = {};
if (emscripten_webgl_get_context_attributes (aWebGlCtx, &anAttribs) == EMSCRIPTEN_RESULT_SUCCESS)
{
toCheckVer3 = anAttribs.majorVersion >= 2;
}
}
#endif
// Available since OpenGL 3.0 and OpenGL ES 3.0.
if (toCheckVer3)
{
GLint aMajor = 0, aMinor = 0;
glGetIntegerv (GL_MAJOR_VERSION, &aMajor);
glGetIntegerv (GL_MINOR_VERSION, &aMinor);
@ -1068,7 +1083,7 @@ void OpenGl_Context::ReadGlVersion (Standard_Integer& theGlVerMajor,
break;
}
}
#endif
}
// Read version string.
// Notice that only first two numbers split by point '2.1 XXXXX' are significant.