From 7106e4c8b1085608711f3278f676d2e05b0ee9f1 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 2 Feb 2021 23:02:51 +0300 Subject: [PATCH] 0032113: Visualization, TKOpenGl - broken PBR diffuse map within OpenGl_Caps::buffersOpaqueAlpha() on OpenGL ES 2.0 Fixed enabling of alpha channel writes while baking PBR environment. --- src/OpenGl/OpenGl_PBREnvironment.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/OpenGl/OpenGl_PBREnvironment.cxx b/src/OpenGl/OpenGl_PBREnvironment.cxx index 14188a7e42..65719aff4c 100644 --- a/src/OpenGl/OpenGl_PBREnvironment.cxx +++ b/src/OpenGl/OpenGl_PBREnvironment.cxx @@ -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 (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 myColorMask; Standard_Boolean myDepthTestWasEnabled; Standard_Boolean myDepthWrirtingWasEnablig; Standard_Boolean myScissorTestWasEnabled;