]> OCCT Git - occt.git/commitdiff
0033647: Visualization - A problem with viewer background corner aspects CR33647
authorhosali <Hossam.Ali@opencascade.com>
Mon, 22 Apr 2024 11:00:48 +0000 (11:00 +0000)
committerhosali <Hossam.Ali@opencascade.com>
Mon, 22 Apr 2024 15:01:48 +0000 (15:01 +0000)
Initialize and setup the gradient background shader in background drawing call

src/OpenGl/OpenGl_View.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx

index 790779556779e7b528070c0260fd90a6d41729f5..25c846240bc5c5df03e3dc0e43590bcc40a80189 100644 (file)
@@ -1103,6 +1103,13 @@ void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace,
       if (myBackgrounds[Graphic3d_TOB_GRADIENT]->GradientFillMethod() >= Aspect_GradientFillMethod_Corner1
        && myBackgrounds[Graphic3d_TOB_GRADIENT]->GradientFillMethod() <= Aspect_GradientFillMethod_Corner4)
       {
+        // Set colored quad shader program
+        Quantity_Color aColor1, aColor2;
+        GradientBackground().Colors(aColor1, aColor2);
+        myColoredQuadParams->Aspect()->SetShaderProgram(aCtx->ShaderManager()->GetColoredQuadProgram());
+        myColoredQuadParams->Aspect()->ShaderProgram()->PushVariableVec3 ("uColor1", aColor1.Rgb());
+        myColoredQuadParams->Aspect()->ShaderProgram()->PushVariableVec3 ("uColor2", aColor2.Rgb());
+       
         const OpenGl_Aspects* anOldAspectFace = theWorkspace->SetAspects (myColoredQuadParams);
 
         myBackgrounds[Graphic3d_TOB_GRADIENT]->Render (theWorkspace, theProjection);
index d700adce803dae7ba38b9e8d77a0db929e36e944..39d09cd8bae5d35a879688acab3e2dc3702083b2 100644 (file)
@@ -211,8 +211,8 @@ static struct
     }
   }
 
-} ViewerTest_DefaultBackground = { Quantity_NOC_BLACK, Quantity_NOC_BLACK, Quantity_NOC_BLACK, Aspect_GradientFillMethod_None };
-
+ } ViewerTest_DefaultBackground = { Quantity_NOC_BLACK, Quantity_NOC_BLACK, Quantity_NOC_BLACK, Aspect_GradientFillMethod_None };
 //==============================================================================
 //  EVENT GLOBAL VARIABLES
 //==============================================================================
@@ -795,7 +795,6 @@ TCollection_AsciiString ViewerTest::ViewerInit (const ViewerTest_VinitParams& th
 #endif
 
   VT_GetWindow()->Map();
-
   // Set the handle of created view in the event manager
   ViewerTest::ResetEventManager();