const OpenGl_GlobalLayerSettings& theDefaultSettings) const
{
const Graphic3d_PolygonOffset anAppliedOffsetParams = theWorkspace->AppliedPolygonOffset();
-
- // separate depth buffers
- if (myLayerSettings.ToClearDepth())
- {
- glClear (GL_DEPTH_BUFFER_BIT);
- }
+ // myLayerSettings.ToClearDepth() is handled outside
// handle depth test
if (myLayerSettings.ToEnableDepthTest())
aCtx->core11fwd->glGetBooleanv (GL_DEPTH_WRITEMASK, &aDefaultSettings.DepthMask);
Standard_Integer aSeqId = myLayers.Lower();
+ bool toClearDepth = false;
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
{
if (theLayersToProcess == OpenGl_LF_Bottom)
}
const OpenGl_Layer& aLayer = anIts.Value();
- if (aLayer.NbStructures() < 1)
+ if (aLayer.IsImmediate() != theToDrawImmediate)
{
continue;
}
- else if (theToDrawImmediate)
+ else if (aLayer.NbStructures() < 1)
{
- if (!aLayer.IsImmediate())
- {
- continue;
- }
+ // make sure to clear depth of previous layers even if layer has no structures
+ toClearDepth = toClearDepth || aLayer.LayerSettings().ToClearDepth();
+ continue;
}
- else
+
+ // depth buffers
+ if (toClearDepth
+ || aLayer.LayerSettings().ToClearDepth())
{
- if (aLayer.IsImmediate())
- {
- continue;
- }
+ toClearDepth = false;
+ glDepthMask (GL_TRUE);
+ glClear (GL_DEPTH_BUFFER_BIT);
}
- // render layer
aLayer.Render (theWorkspace, aDefaultSettings);
}
+ if (toClearDepth)
+ {
+ glDepthMask (GL_TRUE);
+ glClear (GL_DEPTH_BUFFER_BIT);
+ }
+
aCtx->core11fwd->glDepthMask (aDefaultSettings.DepthMask);
aCtx->core11fwd->glDepthFunc (aDefaultSettings.DepthFunc);
}
--- /dev/null
+puts "==========="
+puts "OCC28127"
+puts "Visualization - transparent object breaks Z-Layer depth buffer clear"
+puts "==========="
+puts ""
+
+pload MODELING VISUALIZATION
+box r 0 0 0 1 0.1 1
+box g 0 0.2 0 1 0.1 1
+box b 0 0.4 0 1 0.1 1
+
+vclear
+vinit View1
+vaxo
+vdisplay -noupdate -dispMode 1 -top r g b
+vsetcolor -noupdate r RED
+vsetcolor -noupdate g GREEN
+vsetcolor -noupdate b BLUE1
+vfit
+
+vdisplay -topmost g
+vzbufftrihedron -on -position left_upper
+
+vsettransparency b 0.5
+
+if { [vreadpixel 150 150 rgb name] != "GREEN3" } { puts "Error: wrong color - GREEN box should overlap RED one" }
+if { [vreadpixel 84 64 rgb name] == "RED3" } { puts "Error: wrong color - Trihedron should overlap RED box" }
+
+vdump $imagedir/${casename}.png