]> OCCT Git - occt.git/commitdiff
0032301: Visualization, TKOpenGl - depth peeling is broken with OpenGl_Caps::buffersO...
authorkgv <kgv@opencascade.com>
Thu, 15 Apr 2021 12:34:52 +0000 (15:34 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 16 Apr 2021 15:19:49 +0000 (18:19 +0300)
OpenGl_LayerList::renderTransparent() - color mask is now set to write into Alpha channel of depth peeling FBOs.
OpenGl_View::blitBuffers() - avoid using undefined color for glClear(GL_COLOR_BUFFER_BIT) operation.

src/OpenGl/OpenGl_LayerList.cxx
src/OpenGl/OpenGl_View.cxx
tests/opengl/data/transparency/oit

index 563bc6726b40b6eb37465c313f5a42e6f785ee31..53d616fb946033d1a9e68bfb1c0a1f84991cc365 100644 (file)
@@ -966,6 +966,7 @@ void OpenGl_LayerList::renderTransparent (const Handle(OpenGl_Workspace)&   theW
       // initialize min/max depth buffer
       aGlBlendBackFBO->BindDrawBuffer (aCtx);
       aCtx->SetDrawBuffers (1, THE_DRAW_BUFFERS0);
+      aCtx->SetColorMaskRGBA (NCollection_Vec4<bool> (true)); // force writes into all components, including alpha
       aCtx->core20fwd->glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
       aCtx->core20fwd->glClear (GL_COLOR_BUFFER_BIT);
 
@@ -1122,6 +1123,7 @@ void OpenGl_LayerList::renderTransparent (const Handle(OpenGl_Workspace)&   theW
         theReadDrawFbo->BindBuffer (aCtx);
       }
       aCtx->SetDrawBuffers (1, THE_DRAW_BUFFERS0);
+      aCtx->SetColorMask (true); // update writes into alpha component
       break;
     }
   }
index 3f6b63bad8187ce1cb777c7472f4335ea42f1f15..2900289ea5d2ce3b7cf62a603ccf1d55f78a9e56 100644 (file)
@@ -2558,6 +2558,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
 
   aCtx->SetColorMaskRGBA (NCollection_Vec4<bool> (true)); // force writes into all components, including alpha
   aCtx->core20fwd->glClearDepth (1.0);
+  aCtx->core20fwd->glClearColor (0.0f, 0.0f, 0.0f, aCtx->caps->buffersOpaqueAlpha ? 1.0f : 0.0f);
   aCtx->core20fwd->glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
   aCtx->SetColorMask (true); // restore default alpha component write state
 
index 3c4747784584dd48fc2986a31a551af1565eaccd..a6f004731bd293526ce89dc9e56370835adfa2cb 100644 (file)
@@ -36,6 +36,11 @@ vdump $imagedir/${casename}_weight.png
 vrenderparams -oit peeling 4
 vdump $imagedir/${casename}_peel.png
 
+# test opaqueAlpha option - result should be the same
+vcaps -opaqueAlpha 1
+vdump $imagedir/${casename}_peel_rgb.png
+vcaps -opaqueAlpha 0
+
 # VTK viewer, just for comparison
 set hasVtk 0
 if { [vdriver -default] == "TKOpenGl" } {