From: kgv Date: Tue, 19 Sep 2017 09:53:15 +0000 (+0300) Subject: 0029125: Visualization, OpenGl_Text - fix access violation within OpenGL1.1 context X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=e591ee0af95219438f293ef010f7880038dc2533;p=occt-copy.git 0029125: Visualization, OpenGl_Text - fix access violation within OpenGL1.1 context OpenGl_Context::DiagnosticInformation() - added OpenGL version check before retrieving GL_SHADING_LANGUAGE_VERSION string. --- diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index 94dbf6862a..963e27e660 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -2797,7 +2797,10 @@ void OpenGl_Context::DiagnosticInformation (TColStd_IndexedDataMapOfStringString addInfo (theDict, "GLvendor", (const char*)::glGetString (GL_VENDOR)); addInfo (theDict, "GLdevice", (const char*)::glGetString (GL_RENDERER)); addInfo (theDict, "GLversion", (const char*)::glGetString (GL_VERSION)); - addInfo (theDict, "GLSLversion", (const char*)::glGetString (GL_SHADING_LANGUAGE_VERSION)); + if (IsGlGreaterEqual (2, 0)) + { + addInfo (theDict, "GLSLversion", (const char*)::glGetString (GL_SHADING_LANGUAGE_VERSION)); + } if (myIsGlDebugCtx) { addInfo (theDict, "GLdebug", "ON"); diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index 69a1ec6b1e..ab702b0738 100644 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -720,7 +721,14 @@ void OpenGl_Text::drawRect (const Handle(OpenGl_Context)& theCtx, OpenGl_Vec2(myBndBox.Left, myBndBox.Bottom), OpenGl_Vec2(myBndBox.Left, myBndBox.Top) }; - myBndVertsVbo = new OpenGl_VertexBuffer(); + if (theCtx->ToUseVbo()) + { + myBndVertsVbo = new OpenGl_VertexBuffer(); + } + else + { + myBndVertsVbo = new OpenGl_VertexBufferCompat(); + } myBndVertsVbo->Init (theCtx, 2, 4, aQuad[0].GetData()); }