]> OCCT Git - occt-copy.git/commitdiff
remarks correction CR31457
authornds <nds@opencascade.com>
Mon, 7 Sep 2020 17:44:55 +0000 (20:44 +0300)
committernds <nds@opencascade.com>
Mon, 7 Sep 2020 17:44:55 +0000 (20:44 +0300)
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_FrameBuffer.cxx
src/OpenGl/OpenGl_View_Redraw.cxx

index 257f8d425faa5979f61318fd9ecc3c515f120782..7c66f102baa521fb9d2a5043cb6480973972e13b 100644 (file)
@@ -458,6 +458,7 @@ void OpenGl_Context::SetReadBuffer (const Standard_Integer theReadBuffer)
    && arbFBO != NULL)
   {
     arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
+    SetActiveFrameBuffer (NULL);
   }
   ::glReadBuffer (myReadBuffer);
 #else
@@ -477,6 +478,7 @@ void OpenGl_Context::SetDrawBuffer (const Standard_Integer theDrawBuffer)
    && arbFBO != NULL)
   {
     arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
+    SetActiveFrameBuffer (NULL);
   }
   ::glDrawBuffer (aDrawBuffer);
 
@@ -517,6 +519,7 @@ void OpenGl_Context::SetDrawBuffers (const Standard_Integer theNb, const Standar
   if (arbFBO != NULL && useDefaultFbo)
   {
     arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
+    SetActiveFrameBuffer (NULL);
   }
 
   myFuncs->glDrawBuffers (theNb, (const GLenum*)theDrawBuffers);
index b1d16e311f93f139bf0b58ed2fbf4bd6aae1b2b1..1c788df03f0ad8deb731fd2a7d539b5e343821a7 100644 (file)
@@ -923,7 +923,7 @@ public: //! @name methods to alter or retrieve current state
   }
 
   //! Setup Active Frame Buffer Object.
-  Standard_EXPORT void SetActiveFrameBuffer (const Handle(OpenGl_FrameBuffer)& theFbo)
+  void SetActiveFrameBuffer (const Handle(OpenGl_FrameBuffer)& theFbo)
   {
     myActiveFbo = theFbo;
   }
index 00fd8c2f8417f963c1014a438ae7108ec2ced98f..5459b69ac2ee5addcdb822eb2ad5cb2710e2a9b1 100644 (file)
@@ -196,6 +196,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
   // Build FBO and setup it as texture
   theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
   theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
+  theGlContext->SetActiveFrameBuffer (this);
 
   for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
   {
@@ -346,6 +347,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
   // Build FBO and setup it as texture
   theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
   theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
+  theGlContext->SetActiveFrameBuffer (this);
   for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
   {
     const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
@@ -512,6 +514,7 @@ Standard_Boolean OpenGl_FrameBuffer::InitWithRB (const Handle(OpenGl_Context)& t
   // create FBO
   theGlCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
   theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
+  theGlCtx->SetActiveFrameBuffer (this);
   theGlCtx->arbFBO->glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                                GL_RENDERBUFFER, myGlColorRBufferId);
   if (myGlDepthRBufferId != NO_RENDERBUFFER)
@@ -692,7 +695,6 @@ void OpenGl_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theGlCtx)
 {
   theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
   theGlCtx->SetFrameBufferSRGB (true);
-  
   theGlCtx->SetActiveFrameBuffer (this);
 }
 
@@ -704,6 +706,7 @@ void OpenGl_FrameBuffer::BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx)
 {
   theGlCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myGlFBufferId);
   theGlCtx->SetFrameBufferSRGB (true);
+  theGlCtx->SetActiveFrameBuffer (this);
 }
 
 // =======================================================================
@@ -713,6 +716,7 @@ void OpenGl_FrameBuffer::BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx)
 void OpenGl_FrameBuffer::BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx)
 {
   theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId);
+  theGlCtx->SetActiveFrameBuffer (this);
 }
 
 // =======================================================================
@@ -730,6 +734,7 @@ void OpenGl_FrameBuffer::UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx)
   {
     theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, NO_FRAMEBUFFER);
     theGlCtx->SetFrameBufferSRGB (false);
+    theGlCtx->SetActiveFrameBuffer (NULL);
   }
 }
 
index bbe25aa22338bd7fb3dffd40c8b6a42e6a4722d1..aa2b89e37e64f8e0b3ab68c5dc119084877d6a07 100644 (file)
@@ -1269,6 +1269,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
           {
             aCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
             aCtx->SetFrameBufferSRGB (false);
+            aCtx->SetActiveFrameBuffer (NULL);
           }
 
           // Render non-polygonal elements in default layer
@@ -1285,6 +1286,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
       {
         aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, 0);
         aCtx->SetFrameBufferSRGB (false);
+        aCtx->SetActiveFrameBuffer (NULL);
       }
 
       // Reset OpenGl aspects state to default to avoid enabling of
@@ -1483,6 +1485,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
   {
     aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
     aCtx->SetFrameBufferSRGB (false);
+    aCtx->SetActiveFrameBuffer (NULL);
   }
   const Standard_Integer aViewport[4] = { 0, 0, aDrawSizeX, aDrawSizeY };
   aCtx->ResizeViewport (aViewport);
@@ -1528,6 +1531,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
       }
       aCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
       aCtx->SetFrameBufferSRGB (false);
+      aCtx->SetActiveFrameBuffer (NULL);
     }
 
     // we don't copy stencil buffer here... does it matter for performance?
@@ -1569,6 +1573,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
     {
       aCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
       aCtx->SetFrameBufferSRGB (false);
+      aCtx->SetActiveFrameBuffer (NULL);
     }
   }
   else