From 048e1b3b03f0a6a70b6c67c9d01ff85b1ce5876b Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 19 Sep 2017 12:53:15 +0300 Subject: [PATCH] 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. --- src/OpenGl/OpenGl_Context.cxx | 5 ++++- src/OpenGl/OpenGl_Text.cxx | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index 538331a5d7..494ca044f5 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -2816,7 +2816,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 9a8633fe99..a7ee8eb005 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()); } -- 2.20.1