From 32e664ce3f287f775f3b474e57b99938243d30fe Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 30 Dec 2019 13:07:57 +0300 Subject: [PATCH] 0031278: Visualization - display elements above transparent area # comment DEBUG_INFO as it leads to poor performance, restore some commented code in text --- src/OpenGl/OpenGl_Group.cxx | 2 +- src/OpenGl/OpenGl_LayerList.cxx | 2 +- src/OpenGl/OpenGl_PrimitiveArray.cxx | 2 +- src/OpenGl/OpenGl_Structure.cxx | 4 +++- src/OpenGl/OpenGl_Text.cxx | 31 ++++++++++++++-------------- src/OpenGl/OpenGl_View_Redraw.cxx | 2 +- src/OpenGl/OpenGl_Workspace.cxx | 2 +- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/OpenGl/OpenGl_Group.cxx b/src/OpenGl/OpenGl_Group.cxx index 1fe886273f..8c6f0ff4d0 100644 --- a/src/OpenGl/OpenGl_Group.cxx +++ b/src/OpenGl/OpenGl_Group.cxx @@ -28,7 +28,7 @@ #include #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include diff --git a/src/OpenGl/OpenGl_LayerList.cxx b/src/OpenGl/OpenGl_LayerList.cxx index f1188f5847..3b8d2c3021 100644 --- a/src/OpenGl/OpenGl_LayerList.cxx +++ b/src/OpenGl/OpenGl_LayerList.cxx @@ -26,7 +26,7 @@ #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index 93473710cd..5573c7ff1d 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -29,7 +29,7 @@ #include #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index f81e5eedc2..a552a33ff2 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -25,7 +25,7 @@ #include #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include @@ -389,8 +389,10 @@ void OpenGl_Structure::Clear (const Handle(OpenGl_Context)& theGlCtx) void OpenGl_Structure::renderGeometry (const Handle(OpenGl_Workspace)& theWorkspace, bool& theHasClosed) const { +#ifdef DEBUG_INFO Message_PerfMeter aPerfMeter; MESSAGE_INFO("OpenGl_Structure::renderGeometry", "", &aPerfMeter, NULL) +#endif if (myInstancedStructure != NULL) { diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index eaf07a1d76..2fe1563ea0 100644 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -30,7 +30,7 @@ #include #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include @@ -285,7 +285,6 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx, // ======================================================================= void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const { - #ifdef DEBUG_INFO Message_PerfMeter aPerfMeter; @@ -293,8 +292,10 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const DumpJson (aGroupStream); MESSAGE_INFO_STREAM (aGroupStream, "OpenGl_Text::Render", "", &aPerfMeter, NULL) Handle(Message_Alert) aParentAlert = OCCT_Message_Alert; - +#endif const OpenGl_Aspects* aTextAspect = theWorkspace->ApplyAspects(); + +#ifdef DEBUG_INFO aGroupStream.str(""); aTextAspect->DumpJson (aGroupStream); MESSAGE_INFO_STREAM (aGroupStream, "aTextAspect", "", &aPerfMeter, aParentAlert) @@ -356,7 +357,7 @@ void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx, unsigned int theResolution) const { #if !defined(GL_ES_VERSION_2_0) - const Standard_Integer aPrevPolygonMode = theCtx->SetPolygonMode (GL_FILL && GL_LINE && GL_POINT); + const Standard_Integer aPrevPolygonMode = theCtx->SetPolygonMode (GL_FILL); const bool aPrevHatchingMode = theCtx->SetPolygonHatchEnabled (false); #endif @@ -806,10 +807,10 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx, } case Aspect_TODT_SHADOW: { - //BackPolygonOffsetSentry aPolygonOffsetTmp (hasDepthTest ? theCtx : Handle(OpenGl_Context)()); - //theCtx->SetColor4fv (theColorSubs); - //setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, -1.0f, 0.0f)); - //drawText (theCtx, theTextAspect); + BackPolygonOffsetSentry aPolygonOffsetTmp (hasDepthTest ? theCtx : Handle(OpenGl_Context)()); + theCtx->SetColor4fv (theColorSubs); + setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, -1.0f, 0.0f)); + drawText (theCtx, theTextAspect); break; } case Aspect_TODT_DIMENSION: @@ -864,16 +865,16 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx, #endif const bool aColorMaskBack = theCtx->SetColorMask (false); - //glClear (GL_STENCIL_BUFFER_BIT); - //glEnable (GL_STENCIL_TEST); - //glStencilFunc (GL_ALWAYS, 1, 0xFF); - //glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE); + glClear (GL_STENCIL_BUFFER_BIT); + glEnable (GL_STENCIL_TEST); + glStencilFunc (GL_ALWAYS, 1, 0xFF); + glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE); - //drawRect (theCtx, theTextAspect, OpenGl_Vec4 (1.0f, 1.0f, 1.0f, 1.0f)); + drawRect (theCtx, theTextAspect, OpenGl_Vec4 (1.0f, 1.0f, 1.0f, 1.0f)); - //glStencilFunc (GL_ALWAYS, 0, 0xFF); + glStencilFunc (GL_ALWAYS, 0, 0xFF); - //theCtx->SetColorMask (aColorMaskBack); + theCtx->SetColorMask (aColorMaskBack); } // reset OpenGL state diff --git a/src/OpenGl/OpenGl_View_Redraw.cxx b/src/OpenGl/OpenGl_View_Redraw.cxx index c4a54e30ba..1fd9aab95a 100644 --- a/src/OpenGl/OpenGl_View_Redraw.cxx +++ b/src/OpenGl/OpenGl_View_Redraw.cxx @@ -39,7 +39,7 @@ #include #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index d05046ea25..a9032de1f2 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -33,7 +33,7 @@ #include #include -#define DEBUG_INFO +//#define DEBUG_INFO #ifdef DEBUG_INFO #include #include -- 2.39.5