1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0027735: Visualization, OpenGl_ShaderManager - fix clipping state management

OpenGl_CappingAlgo::RenderCapping() now updates clipping state in Shader Manager.
OpenGl_View::render() clipping state setup has been moved to OpenGl_View::renderScene().

OpenGl_ShaderManager now converts position to homogeneous coordinates within clipping code GLSL.
This fixes capping plane rendering with clipping planes applied.

Fixed possible Clipping planes misconfiguration when FFP is used;
error-prone OpenGl_Clipping::AddWorldLazy() method has been dropped.
This commit is contained in:
kgv
2016-08-05 20:58:13 +03:00
committed by bugmaster
parent c58b1b6257
commit deb02f8655
7 changed files with 31 additions and 49 deletions

View File

@@ -14,13 +14,14 @@
// commercial license or contractual agreement.
#include <OpenGl_CappingAlgo.hxx>
#include <OpenGl_Workspace.hxx>
#include <OpenGl_Context.hxx>
#include <OpenGl_PrimitiveArray.hxx>
#include <OpenGl_CappingPlaneResource.hxx>
#include <OpenGl_Vec.hxx>
#include <OpenGl_Structure.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <OpenGl_ShaderManager.hxx>
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_CappingAlgoFilter,OpenGl_RenderFilter)
@@ -98,6 +99,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
const Standard_Boolean isOn = (aPlane == aRenderPlane);
aContext->ChangeClipping().SetEnabled (aContext, aPlane, isOn);
}
aContext->ShaderManager()->UpdateClippingState();
glClear (GL_STENCIL_BUFFER_BIT);
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -126,6 +128,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
const Standard_Boolean isOn = (aPlane != aRenderPlane);
aContext->ChangeClipping().SetEnabled (aContext, aPlane, isOn);
}
aContext->ShaderManager()->UpdateClippingState();
// render capping plane using the generated stencil mask
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -135,6 +138,9 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
glEnable (GL_DEPTH_TEST);
RenderPlane (theWorkspace, aRenderPlane);
aContext->ShaderManager()->RevertClippingState();
aContext->ShaderManager()->RevertClippingState();
}
// restore previous application state