0025217: Draw Harness - activate GLSL warnings output within command vgldebug
[occt.git] / src / ViewerTest / ViewerTest_ViewerCommands.cxx
index 5d5e016..88d9866 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#ifdef HAVE_CONFIG_H
-  #include <config.h>
-#endif
-
 #include <OpenGl_GlCore20.hxx>
 #include <AIS_Shape.hxx>
 #include <AIS_Drawer.hxx>
@@ -4039,10 +4035,15 @@ static int VGlDebug (Draw_Interpretor& theDI,
                      Standard_Integer  theArgNb,
                      const char**      theArgVec)
 {
+  Handle(OpenGl_GraphicDriver) aDriver;
+  Handle(V3d_View) aView = ViewerTest::CurrentView();
+  if (!aView.IsNull())
+  {
+    aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aView->Viewer()->Driver());
+  }
   if (theArgNb < 2)
   {
-    Handle(V3d_View) aView = ViewerTest::CurrentView();
-    if (aView.IsNull())
+    if (aDriver.IsNull())
     {
       std::cerr << "No active view. Please call vinit.\n";
       return 0;
@@ -4055,7 +4056,15 @@ static int VGlDebug (Draw_Interpretor& theDI,
     return 0;
   }
 
-  ViewerTest_myDefaultCaps.contextDebug = Draw::Atoi (theArgVec[1]) != 0;
+  const Standard_Boolean toEnableDebug = Draw::Atoi (theArgVec[1]) != 0;
+  ViewerTest_myDefaultCaps.contextDebug = toEnableDebug;
+  ViewerTest_myDefaultCaps.glslWarnings = toEnableDebug;
+  if (aDriver.IsNull())
+  {
+    return 0;
+  }
+
+  aDriver->ChangeOptions().glslWarnings = toEnableDebug;
   return 0;
 }
 
@@ -5455,7 +5464,9 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
         Standard_Real aBlu = atof (theArgVec [7]);
 
         Graphic3d_MaterialAspect aMat = aClipPlane->CappingMaterial();
-        aMat.SetColor (Quantity_Color (aRed, aGrn, aBlu, Quantity_TOC_RGB));
+        Quantity_Color aColor (aRed, aGrn, aBlu, Quantity_TOC_RGB);
+        aMat.SetAmbientColor (aColor);
+        aMat.SetDiffuseColor (aColor);
         aClipPlane->SetCappingMaterial (aMat);
       }
       else if (aCappingArg == "texname") // texture name