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.
// 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)
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);
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);
glEnable (GL_DEPTH_TEST);
RenderPlane (theWorkspace, aRenderPlane);
+
+ aContext->ShaderManager()->RevertClippingState();
+ aContext->ShaderManager()->RevertClippingState();
}
// restore previous application state
add (theGlCtx, EquationCoords_World, thePlanes);
}
- //! Add planes to the context clipping at the world system of coordinates.
- //! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
- //! are simply ignored.
- //! @param thePlanes [in/out] the list of planes to be added
- //! The list then provides information on which planes were really added to clipping state.
- //! This list then can be used to fall back to previous state.
- inline void AddWorldLazy (const Handle(OpenGl_Context)& theGlCtx,
- Graphic3d_SequenceOfHClipPlane& thePlanes)
- {
- addLazy (theGlCtx, EquationCoords_World, thePlanes);
- }
-
//! Remove all of the planes from context state.
inline void RemoveAll (const Handle(OpenGl_Context)& theGlCtx)
{
EOL" int aClipSpace = occClipPlaneSpaces[aPlaneIter];"
EOL" if (aClipSpace == OccEquationCoords_World)"
EOL" {"
- EOL" if (dot (aClipEquation.xyz, PositionWorld.xyz) + aClipEquation.w < 0.0)"
+ EOL" if (dot (aClipEquation.xyz, PositionWorld.xyz / PositionWorld.w) + aClipEquation.w < 0.0)"
EOL" {"
EOL" discard;"
EOL" }"
aCtx->ChangeClipping().AddWorld (aCtx, *aUserPlanes);
// Set OCCT state uniform variables
- if (!aCtx->ShaderManager()->IsEmpty())
- {
- aCtx->ShaderManager()->UpdateClippingState();
- }
+ aCtx->ShaderManager()->UpdateClippingState();
}
// Render groups
aCtx->ChangeClipping().Remove (aCtx, *aUserPlanes);
// Set OCCT state uniform variables
- if (!aCtx->ShaderManager()->IsEmpty())
- {
- aCtx->ShaderManager()->RevertClippingState();
- }
+ aCtx->ShaderManager()->RevertClippingState();
}
// Restore local transformation
#endif
aManager->SetShadingModel (myShadingModel);
- if (!aManager->IsEmpty())
- {
- aManager->UpdateClippingState();
- }
// Redraw 3d scene
if (theProjection == Graphic3d_Camera::Projection_MonoLeftEye)
// before drawing auxiliary stuff (trihedrons, overlayer)
myWorkspace->ResetAppliedAspect();
- aContext->ChangeClipping().RemoveAll (aContext);
- if (!aManager->IsEmpty())
- {
- aManager->RevertClippingState();
-
- // We need to disable (unbind) all shaders programs to ensure
- // that all objects without specified aspect will be drawn
- // correctly (such as background)
- aContext->BindProgram (NULL);
- }
+ // We need to disable (unbind) all shaders programs to ensure
+ // that all objects without specified aspect will be drawn
+ // correctly (such as background)
+ aContext->BindProgram (NULL);
// Render trihedron
if (!theToDrawImmediate)
// add planes at loaded view matrix state
aContext->ChangeClipping().AddView (aContext, aSlicingPlanes);
}
+
+ aContext->ShaderManager()->UpdateClippingState();
}
#ifdef _WIN32
if (!aUserPlanes.IsEmpty())
{
- aContext->ChangeClipping().AddWorldLazy (aContext, aUserPlanes);
+ aContext->ChangeClipping().AddWorld (aContext, aUserPlanes);
}
- if (!aContext->ShaderManager()->IsEmpty())
- {
- aContext->ShaderManager()->UpdateClippingState();
- }
+ aContext->ShaderManager()->UpdateClippingState();
}
#if !defined(GL_ES_VERSION_2_0)
// Apply restored view matrix.
aContext->ApplyWorldViewMatrix();
+ aContext->ChangeClipping().RemoveAll (aContext);
+ if (!myClipPlanes.IsEmpty())
+ {
+ aContext->ShaderManager()->RevertClippingState();
+ }
+ if (myZClip.Back.IsOn || myZClip.Front.IsOn)
+ {
+ aContext->ShaderManager()->RevertClippingState();
+ }
+
#ifdef _WIN32
// set printing scale/tiling transformation
if (!aPrintContext.IsNull())
int aClipSpace = occClipPlaneSpaces[anIndex];
if (aClipSpace == OccEquationCoords_World)
{
- if (dot (aClipEquation.xyz, PositionWorld.xyz) + aClipEquation.w < 0.0)
+ if (dot (aClipEquation.xyz, PositionWorld.xyz / PositionWorld.w) + aClipEquation.w < 0.0)
{
discard;
}
set x3_coord 73
set y3_coord 150
-# enable FFP until bug-fix for GLSL
-vcaps -ffp 1
-
-vinit
+vclear
+vinit View1
box b1 0 0 0 10 10 10
box b2 30 0 0 10 40 10
box b3 -30 0 0 20 20 20
checkcolor $x3_coord $y3_coord 0.5 0.5 0.9
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
-
-
-