From: apl Date: Thu, 10 Jul 2014 09:06:13 +0000 (+0400) Subject: 0025060: Capping breaks highlighting of shaded AIS_Shape with displayed edges X-Git-Tag: V6_8_0_beta~209 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=347423b2c2948db250a9c28e0c4403b5c40ade9d 0025060: Capping breaks highlighting of shaded AIS_Shape with displayed edges Capping algorithm - remember and restore depth function mode. --- diff --git a/src/OpenGl/OpenGl_CappingAlgo.cxx b/src/OpenGl/OpenGl_CappingAlgo.cxx index 54315342a7..d0bdb57c10 100755 --- a/src/OpenGl/OpenGl_CappingAlgo.cxx +++ b/src/OpenGl/OpenGl_CappingAlgo.cxx @@ -103,6 +103,12 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWork // prepare for rendering the clip planes glEnable (GL_STENCIL_TEST); + // remember current state of depth + // function and change its value + GLint aDepthFuncPrev; + glGetIntegerv (GL_DEPTH_FUNC, &aDepthFuncPrev); + glDepthFunc (GL_LESS); + // generate capping for every clip plane for (aCappingIt.Init (aContextPlanes); aCappingIt.More(); aCappingIt.Next()) { @@ -158,7 +164,6 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWork // render capping plane using the generated stencil mask glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask (GL_TRUE); - glDepthFunc (GL_LESS); glStencilFunc (GL_EQUAL, 1, 0x01); glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP); glEnable (GL_DEPTH_TEST); @@ -168,6 +173,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWork // restore previous application state glClear (GL_STENCIL_BUFFER_BIT); + glDepthFunc (aDepthFuncPrev); glStencilFunc (GL_ALWAYS, 0, 0xFF); glDisable (GL_STENCIL_TEST); diff --git a/tests/bugs/vis/bug25060 b/tests/bugs/vis/bug25060 new file mode 100644 index 0000000000..30bad6ee7c --- /dev/null +++ b/tests/bugs/vis/bug25060 @@ -0,0 +1,27 @@ +puts "============" +puts "CR25060" +puts "============" +puts "" +####################################################################### +# Capping breaks highlighting of shaded AIS_Shape with displayed edges. +####################################################################### +vinit View1 +box b 10 10 10 +vdisplay b +vshowfaceboundary b 1 +vclipplane create pln1 +vclipplane set pln1 object b +vclipplane change pln1 equation 0 1 0 -5 +vclipplane change pln1 capping on +vsetdispmode 1 +vfit +vmoveto 304 146 + +set x_coord 304 +set y_coord 146 +checkcolor $x_coord $y_coord 0 1 1 +if { $stat != 1 } { + puts "Error : Highlighting is broken." +} + +set only_screen 1