]> OCCT Git - occt.git/commitdiff
0032113: Visualization, TKOpenGl - broken PBR diffuse map within OpenGl_Caps::buffers...
authorkgv <kgv@opencascade.com>
Tue, 2 Feb 2021 20:02:51 +0000 (23:02 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 3 Feb 2021 15:34:25 +0000 (18:34 +0300)
Fixed enabling of alpha channel writes while baking PBR environment.

src/OpenGl/OpenGl_PBREnvironment.cxx

index 14188a7e4233a46058d36c18c9a89a87ae4e5f73..65719aff4c4a69b9771e9a1633abe13ba7ebb634 100644 (file)
@@ -48,6 +48,7 @@ private:
 
   void backup()
   {
+    myColorMask = myContext->ColorMaskRGBA();
     myContext->core11fwd->glGetIntegerv (GL_FRAMEBUFFER_BINDING, &myFBO);
     myShaderProgram = myContext->ActiveProgram();
     for (unsigned int i = 0; i < 4; ++i)
@@ -73,10 +74,12 @@ private:
     myContext->core11fwd->glDepthMask (GL_FALSE);
     myContext->core11fwd->glDisable (GL_BLEND);
     myContext->core11fwd->glDisable (GL_SCISSOR_TEST);
+    myContext->SetColorMaskRGBA (NCollection_Vec4<bool> (true)); // force writes into all components, including alpha
   }
 
   void restore()
   {
+    myContext->SetColorMaskRGBA (myColorMask);
     myContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myFBO);
     myContext->BindProgram (myShaderProgram);
     myContext->ResizeViewport (myViewport);
@@ -111,6 +114,7 @@ private:
   const Handle(OpenGl_Context) myContext;
   GLint                        myFBO;
   Handle(OpenGl_ShaderProgram) myShaderProgram;
+  NCollection_Vec4<bool>       myColorMask;
   Standard_Boolean             myDepthTestWasEnabled;
   Standard_Boolean             myDepthWrirtingWasEnablig;
   Standard_Boolean             myScissorTestWasEnabled;