diff --git a/src/OpenGl/OpenGl_DepthPeeling.hxx b/src/OpenGl/OpenGl_DepthPeeling.hxx index 7345cd9c4c..7c34f54c05 100644 --- a/src/OpenGl/OpenGl_DepthPeeling.hxx +++ b/src/OpenGl/OpenGl_DepthPeeling.hxx @@ -36,11 +36,13 @@ public: //! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules. Standard_EXPORT virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE; - //! Attach a texture image + //! Attach a texture image. + //! Resets the active FBO to 0. Standard_EXPORT void AttachDepthTexture (const Handle(OpenGl_Context)& theCtx, const Handle(OpenGl_Texture)& theDepthStencilTexture); - //! Detach a texture image + //! Detach a texture image. + //! Resets the active FBO to 0. Standard_EXPORT void DetachDepthTexture (const Handle(OpenGl_Context)& theCtx); //! Returns additional buffers for ping-pong diff --git a/src/OpenGl/OpenGl_LayerList.cxx b/src/OpenGl/OpenGl_LayerList.cxx index 53d616fb94..d12e38ea5f 100644 --- a/src/OpenGl/OpenGl_LayerList.cxx +++ b/src/OpenGl/OpenGl_LayerList.cxx @@ -1219,6 +1219,13 @@ void OpenGl_LayerList::renderTransparent (const Handle(OpenGl_Workspace)& theW } } aView->DepthPeelingFbos()->DetachDepthTexture (aCtx); + + // Bind the framebuffer for reading depth and writing final color + // after DetachDepthTexture() because after the function it's unbinded. + if (theReadDrawFbo) + { + theReadDrawFbo->BindBuffer (aCtx); + } break; } } diff --git a/tests/opengl/data/transparency/oit_osdtext_bug b/tests/opengl/data/transparency/oit_osdtext_bug new file mode 100644 index 0000000000..ef688e30f3 --- /dev/null +++ b/tests/opengl/data/transparency/oit_osdtext_bug @@ -0,0 +1,26 @@ +puts "========" +puts "0032507: Visualization, TKOpenGl - topmost text disappears with Graphic3d_RTM_DEPTH_PEELING_OIT enabled" +puts "========" + +pload MODELING VISUALIZATION + +vclear +vinit View1 + +box b 1 2 3 +vdisplay b -dispMode 1 +vaspects b -transparency 0.5 +vfit + +vlight headlight -display +vdisplay headlight -2d bottomright 120 50 +vlight amblight -display +vdisplay amblight -2d bottomright 50 50 + +vrenderparams -perfCounters triangles + +vdump $imagedir/${casename}_1.png + +vrenderparams -oit peel + +vdump $imagedir/${casename}_2.png