0026915: Visualization - return Handle from Graphic3d_CView::FBOCreate() instead...
[occt.git] / src / ViewerTest / ViewerTest_ViewerCommands.cxx
index d59a5e5..8a3cdc1 100644 (file)
 // commercial license or contractual agreement.
 
 #include <OpenGl_GlCore20.hxx>
+#include <AIS_ColorScale.hxx>
 #include <AIS_Shape.hxx>
 #include <AIS_InteractiveObject.hxx>
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <DBRep.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
 #include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_ExportFormat.hxx>
 #include <Graphic3d_NameOfTextureEnv.hxx>
 #include <ViewerTest_EventManager.hxx>
 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
-#include <Visual3d_View.hxx>
-#include <Visual3d_ViewManager.hxx>
 #include <V3d_AmbientLight.hxx>
-#include <V3d_ColorScale.hxx>
 #include <V3d_DirectionalLight.hxx>
-#include <V3d_LayerMgr.hxx>
-#include <V3d_LayerMgrPointer.hxx>
 #include <V3d_PositionalLight.hxx>
 #include <V3d_SpotLight.hxx>
 #include <NCollection_DoubleMap.hxx>
@@ -58,7 +55,6 @@
 #include <TColStd_HSequenceOfReal.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <TColStd_MapOfAsciiString.hxx>
-#include <Visual3d_LayerItem.hxx>
 #include <Aspect_TypeOfLine.hxx>
 #include <Image_Diff.hxx>
 #include <Aspect_DisplayConnection.hxx>
 #include <Graphic3d_Texture2Dmanual.hxx>
 #include <Prs3d_ShadingAspect.hxx>
 #include <Prs3d_Drawer.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_Root.hxx>
 
-#ifdef WNT
+#ifdef _WIN32
 #undef DrawText
 #endif
 
-#include <Visual3d_Layer.hxx>
 #include <cstdlib>
 
 #if defined(_WIN32)
   #include <tk.h>
 #endif
 
-inline Standard_Boolean parseOnOff (Standard_CString  theArg,
-                                    Standard_Boolean& theIsOn)
-{
-  TCollection_AsciiString aFlag (theArg);
-  aFlag.LowerCase();
-  if (aFlag == "on"
-   || aFlag == "1")
-  {
-    theIsOn = Standard_True;
-    return Standard_True;
-  }
-  else if (aFlag == "off"
-        || aFlag == "0")
-  {
-    theIsOn = Standard_False;
-    return Standard_True;
-  }
-  return Standard_False;
-}
-
 // Auxiliary definitions
 static const char THE_KEY_DELETE = 127;
 
@@ -219,7 +196,7 @@ Standard_Boolean DragFirst = Standard_False;
 
 //==============================================================================
 
-#ifdef WNT
+#ifdef _WIN32
 static LRESULT WINAPI ViewerWindowProc(
                                        HWND hwnd,
                                        UINT uMsg,
@@ -618,10 +595,10 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
   // Change name of current active window
   if (!ViewerTest::CurrentView().IsNull())
   {
-    TCollection_AsciiString aTitle("3D View - ");
-    aTitle = aTitle
+    TCollection_AsciiString anActiveWindowTitle("3D View - ");
+    anActiveWindowTitle = anActiveWindowTitle
       + ViewerTest_myViews.Find2 (ViewerTest::CurrentView());
-    SetWindowTitle (ViewerTest::CurrentView()->Window(), aTitle.ToCString());
+    SetWindowTitle (ViewerTest::CurrentView()->Window(), anActiveWindowTitle.ToCString());
   }
 
   // Create viewer
@@ -1805,7 +1782,7 @@ static int VBottom(Draw_Interpretor& di, Standard_Integer , const char** )
 
 static int VLeft(Draw_Interpretor& di, Standard_Integer , const char** )
 {
-  return ViewProject(di, V3d_Ypos);
+  return ViewProject(di, V3d_Xneg);
 }
 
 //==============================================================================
@@ -1816,7 +1793,7 @@ static int VLeft(Draw_Interpretor& di, Standard_Integer , const char** )
 
 static int VRight(Draw_Interpretor& di, Standard_Integer , const char** )
 {
-  return ViewProject(di, V3d_Yneg);
+  return ViewProject(di, V3d_Xpos);
 }
 
 //==============================================================================
@@ -1827,7 +1804,7 @@ static int VRight(Draw_Interpretor& di, Standard_Integer , const char** )
 
 static int VFront(Draw_Interpretor& di, Standard_Integer , const char** )
 {
-  return ViewProject(di, V3d_Xpos);
+  return ViewProject(di, V3d_Yneg);
 }
 
 //==============================================================================
@@ -1838,7 +1815,7 @@ static int VFront(Draw_Interpretor& di, Standard_Integer , const char** )
 
 static int VBack(Draw_Interpretor& di, Standard_Integer , const char** )
 {
-  return ViewProject(di, V3d_Xneg);
+  return ViewProject(di, V3d_Ypos);
 }
 
 //==============================================================================
@@ -1887,7 +1864,7 @@ static int VHelp(Draw_Interpretor& di, Standard_Integer , const char** )
   return 0;
 }
 
-#ifdef WNT
+#ifdef _WIN32
 
 static Standard_Boolean Ppick = 0;
 static Standard_Integer Pargc = 0;
@@ -2512,7 +2489,7 @@ static void OSWindowSetup()
   XSynchronize(aDisplay, 0);
 
 #else
-  // WNT
+  // _WIN32
 #endif
 
 }
@@ -2629,7 +2606,7 @@ static int VZFit (Draw_Interpretor& /*theDi*/, Standard_Integer theArgsNb, const
 
   if (theArgsNb == 1)
   {
-    aCurrentView->View()->ZFitAll();
+    aCurrentView->ZFitAll();
     aCurrentView->Redraw();
     return 0;
   }
@@ -2641,7 +2618,7 @@ static int VZFit (Draw_Interpretor& /*theDi*/, Standard_Integer theArgsNb, const
     aScale = Draw::Atoi (theArgVec[1]);
   }
 
-  aCurrentView->View()->ZFitAll (aScale);
+  aCurrentView->ZFitAll (aScale);
   aCurrentView->Redraw();
 
   return 0;
@@ -3187,7 +3164,7 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
   aView->ZBufferTriedronSetup (anArrowColorX.Name(), anArrowColorY.Name(), anArrowColorZ.Name(),
                                aSizeRatio, anArrowDiam, aNbFacets);
   aView->TriedronDisplay (aPosition, aLabelsColor.Name(), aScale, aVisType);
-  aView->View()->ZFitAll();
+  aView->ZFitAll();
   return 0;
 }
 
@@ -3413,8 +3390,9 @@ static int VExport(Draw_Interpretor& di, Standard_Integer argc, const char** arg
     return 1;
   }
 
-  try {
-    if (!V3dView->View()->Export (argv[1], anExpFormat))
+  try
+  {
+    if (!V3dView->Export (argv[1], anExpFormat))
     {
       di << "Error: export of image to " << aFormatStr << " failed!\n";
     }
@@ -3470,31 +3448,59 @@ static int VColorScale (Draw_Interpretor& theDI,
     std::cout << "Error: no active view!\n";
     return 1;
   }
-
-  Handle(V3d_ColorScale) aCS = Handle(V3d_ColorScale)::DownCast (aView->ColorScale());
-  if (aCS.IsNull())
+  if (theArgNb <= 1)
   {
-    std::cout << "Error: color scale is undefined!\n";
+    std::cout << "Error: wrong syntax at command '" << theArgVec[0] << "'!\n";
     return 1;
   }
 
+  Handle(AIS_ColorScale) aCS;
+  // find object
+  Handle(AIS_InteractiveObject) anIObj;
+  if (GetMapOfAIS().IsBound2 (theArgVec[1]))
+  {
+    aCS = Handle(AIS_ColorScale)::DownCast (GetMapOfAIS().Find2 (theArgVec[1]));
+    if (aCS.IsNull())
+    {
+      std::cout << "Error: object '" << theArgVec[1] << "'is already defined and is not a color scale!\n";
+      return 1;
+    }
+  }
+  else
+  {
+    aCS = new AIS_ColorScale();
+    GetMapOfAIS().Bind (aCS,theArgVec[1]);
+  }
+
+  if (aCS->ZLayer() != Graphic3d_ZLayerId_TopOSD)
+  {
+    aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
+  }
+  if (aCS->GetTransformPersistenceMode() != Graphic3d_TMF_2d)
+  {
+    aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
+  }
+
   Standard_Real                   aMinRange    = aCS->GetMin();
   Standard_Real                   aMaxRange    = aCS->GetMax();
+  Standard_Integer                aWidth       = aCS->GetWidth();
+  Standard_Integer                aHeight      = aCS->GetHeight();
   Standard_Integer                aNbIntervals = aCS->GetNumberOfIntervals();
   Standard_Integer                aTextHeight  = aCS->GetTextHeight();
   Aspect_TypeOfColorScalePosition aLabPosition = aCS->GetLabelPosition();
-  gp_XY                           aPos (aCS->GetXPosition(), aCS->GetYPosition());
+  Standard_Integer                aPosX = aCS->GetXPosition();
+  Standard_Integer                aPosY = aCS->GetYPosition();
 
   ViewerTest_AutoUpdater anUpdateTool (aContext, aView);
 
-  if (theArgNb <= 1)
+  if (theArgNb <= 2)
   {
-    theDI << "Current color scale parameters:\n"
+    theDI << "Color scale parameters for '"<< theArgVec[1] << "':\n"
           << "Min range: " << aMinRange << "\n"
           << "Max range: " << aMaxRange << "\n"
           << "Number of intervals: " << aNbIntervals << "\n"
           << "Text height: " << aTextHeight << "\n"
-          << "Color scale position: " << aPos.X() <<" "<< aPos.Y()<< "\n"
+          << "Color scale position: " << aPosX <<" "<< aPosY<< "\n"
           << "Color scale title: " << aCS->GetTitle() << "\n"
           << "Label position: ";
     switch (aLabPosition)
@@ -3514,41 +3520,8 @@ static int VColorScale (Draw_Interpretor& theDI,
     }
     return 0;
   }
-  Standard_CString        aFirstArg = theArgVec[1];
-  TCollection_AsciiString aFlag (aFirstArg);
-  aFlag.LowerCase();
-  if (aFlag == "-hide" ||
-      aFlag == "-erase")
-  {
-    if (theArgNb > 2)
-    {
-      std::cout << "Error: wrong syntax at argument '" << theArgVec[1] << "'!\n";
-      return 1;
-    }
-    if (!aView->ColorScaleIsDisplayed())
-    {
-      std::cout << "Error: color scale is not displayed!\n";
-      return 1;
-   }
-    else
-    {
-      aView->ColorScaleErase();
-      return 0;
-    }
-  }
-  else if (aFlag == "-show" ||
-           aFlag == "-display")
-  {
-    if (theArgNb > 2)
-    {
-      std::cout << "Error: wrong syntax at argument '" << theArgVec[1] << "'!\n";
-      return 1;
-    }
-    aView->ColorScaleDisplay();
-    return 0;
-  }
 
-  for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+  for (Standard_Integer anArgIter = 2; anArgIter < theArgNb; ++anArgIter)
   {
     Standard_CString        anArg = theArgVec[anArgIter];
     TCollection_AsciiString aFlag (anArg);
@@ -3595,14 +3568,14 @@ static int VColorScale (Draw_Interpretor& theDI,
         std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
         return 1;
       }
-      TCollection_AsciiString anArg (theArgVec[anArgIter + 1]);
-      if (!anArg.IsIntegerValue())
+      TCollection_AsciiString aFontArg(theArgVec[anArgIter + 1]);
+      if (!aFontArg.IsIntegerValue())
       {
         std::cout << "Error: HeightFont value should be integer!\n";
         return 1;
       }
 
-      aTextHeight = anArg.IntegerValue();
+      aTextHeight = aFontArg.IntegerValue();
       anArgIter += 1;
     }
     else if (aFlag == "-textpos")
@@ -3612,29 +3585,45 @@ static int VColorScale (Draw_Interpretor& theDI,
         std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
         return 1;
       }
-      TCollection_AsciiString anArg (theArgVec[++anArgIter]);
-      anArg.LowerCase();
-      if (anArg == "none")
+      TCollection_AsciiString aTextPosArg(theArgVec[++anArgIter]);
+      aTextPosArg.LowerCase();
+      if (aTextPosArg == "none")
       {
         aLabPosition = Aspect_TOCSP_NONE;
       }
-      else if (anArg == "left")
+      else if (aTextPosArg == "left")
       {
         aLabPosition = Aspect_TOCSP_LEFT;
       }
-      else if (anArg == "right")
+      else if (aTextPosArg == "right")
       {
         aLabPosition = Aspect_TOCSP_RIGHT;
       }
-      else if (anArg == "center")
+      else if (aTextPosArg == "center")
       {
         aLabPosition = Aspect_TOCSP_CENTER;
       }
       else
       {
-        std::cout << "Error: unknown position '" << anArg << "'!\n";
+        std::cout << "Error: unknown position '" << aTextPosArg << "'!\n";
+        return 1;
+      }
+    }
+    else if (aFlag == "-logarithmic"
+          || aFlag == "-log")
+    {
+      if (anArgIter + 1 >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
         return 1;
       }
+      Standard_Boolean IsLog;
+      if (!ViewerTest::ParseOnOff(theArgVec[++anArgIter], IsLog))
+      {
+        std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+        return 1;
+      }
+      aCS->SetLogarithmic (IsLog);
     }
     else if (aFlag == "-xy")
     {
@@ -3646,14 +3635,51 @@ static int VColorScale (Draw_Interpretor& theDI,
 
       TCollection_AsciiString aX (theArgVec[++anArgIter]);
       TCollection_AsciiString aY (theArgVec[++anArgIter]);
-      if (!aX.IsRealValue()
-       || !aY.IsRealValue())
+      if (!aX.IsIntegerValue()
+       || !aY.IsIntegerValue())
+      {
+        std::cout << "Error: coordinates should be integer values!\n";
+        return 1;
+      }
+
+      aPosX = aX.IntegerValue();
+      aPosY = aY.IntegerValue();
+    }
+    else if (aFlag == "-width"
+          || aFlag == "-w")
+    {
+      if (anArgIter + 1 >= theArgNb)
       {
-        std::cout << "Error: coordinates should be real values!\n";
+        std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+        return 1;
+      }
+
+      TCollection_AsciiString aW (theArgVec[++anArgIter]);
+      if (!aW.IsIntegerValue())
+      {
+        std::cout << "Error: a width should be an integer value!\n";
+        return 1;
+      }
+
+      aWidth = aW.IntegerValue();
+    }
+    else if (aFlag == "-height"
+          || aFlag == "-h")
+    {
+      if (anArgIter + 1 >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
         return 1;
       }
 
-      aPos.SetCoord (aX.RealValue(), aY.RealValue());
+      TCollection_AsciiString aH (theArgVec[++anArgIter]);
+      if (!aH.IsIntegerValue())
+      {
+        std::cout << "Error: a width should be an integer value!\n";
+        return 1;
+      }
+
+      aHeight = aH.IntegerValue();
     }
     else if (aFlag == "-color")
     {
@@ -3696,7 +3722,7 @@ static int VColorScale (Draw_Interpretor& theDI,
       if (Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
       {
         aCS->SetColor    (Quantity_Color (aColorName), anIndex);
-        aCS->SetColorType(Aspect_TOCSD_USER);
+        aCS->SetColorType (Aspect_TOCSD_USER);
         anArgIter += 2;
         continue;
       }
@@ -3858,14 +3884,17 @@ static int VColorScale (Draw_Interpretor& theDI,
     else if (aFlag == "-demoversion"
           || aFlag == "-demo")
     {
-      aPos.SetCoord (0.0, 0.0);
+      aPosX        = 0;
+      aPosY        = 0;
       aTextHeight  = 16;
       aMinRange    = 0.0;
       aMaxRange    = 100;
       aNbIntervals = 10;
+      aWidth       = 0;
+      aHeight      = 0;
       aLabPosition = Aspect_TOCSP_RIGHT;
-      aCS->SetColorType(Aspect_TOCSD_AUTO);
-      aCS->SetLabelType(Aspect_TOCSD_AUTO);
+      aCS->SetColorType (Aspect_TOCSD_AUTO);
+      aCS->SetLabelType (Aspect_TOCSD_AUTO);
     }
     else
     {
@@ -3873,18 +3902,28 @@ static int VColorScale (Draw_Interpretor& theDI,
       return 1;
     }
   }
-
-  aCS->SetPosition          (aPos.X(), aPos.Y());
-  aCS->SetHeight            (0.95);
+  if (!aWidth || !aHeight)
+  {
+    Standard_Integer aWinWidth, aWinHeight;
+    aView->Window()->Size (aWinWidth, aWinHeight);
+    if (!aWidth)
+    {
+      aWidth = aWinWidth;
+    }
+    if (!aHeight)
+    {
+      aHeight = aWinHeight;
+    }
+  }
+  aCS->SetSize              (aWidth, aHeight);
+  aCS->SetPosition          (aPosX, aPosY);
   aCS->SetTextHeight        (aTextHeight);
   aCS->SetRange             (aMinRange, aMaxRange);
   aCS->SetNumberOfIntervals (aNbIntervals);
   aCS->SetLabelPosition     (aLabPosition);
-
-  if (!aView->ColorScaleIsDisplayed())
-  {
-    aView->ColorScaleDisplay();
-  }
+  aCS->SetBGColor           (aView->BackgroundColor());
+  aCS->SetToUpdate();
+  aContext->Display (aCS);
 
   return 0;
 }
@@ -4235,8 +4274,10 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
 static int VPrintView (Draw_Interpretor& di, Standard_Integer argc,
                        const char** argv)
 {
-#ifndef WNT
-  di << "Printing implemented only for wnt!\n";
+#ifndef _WIN32
+  (void )argc;
+  (void )argv;
+  di << "Printing implemented only for WNT!\n";
   return 0;
 #else
 
@@ -4329,15 +4370,15 @@ static int VPrintView (Draw_Interpretor& di, Standard_Integer argc,
     {
       if (isTileSizeProvided)
       {
-        Graphic3d_CView* aCView = static_cast<Graphic3d_CView*> (ViewerTest::CurrentView()->View()->CView());
-        Graphic3d_PtrFrameBuffer anOldBuffer = static_cast<Graphic3d_PtrFrameBuffer> (aCView->ptrFBO);
-        aCView->ptrFBO = aView->View()->FBOCreate (aTileWidth, aTileHeight);
+        Handle(Graphic3d_CView)    aGraphicView = ViewerTest::CurrentView()->View();
+        Handle(Standard_Transient) anOldBuffer  = aGraphicView->FBO();
+        Handle(Standard_Transient) aNewBuffer   = aGraphicView->FBOCreate (aTileWidth, aTileHeight);
+        aGraphicView->SetFBO (aNewBuffer);
 
         isPrinted = aView->Print (anDC, 1, 1, 0, Aspect_PA_TILE);
 
-        Graphic3d_PtrFrameBuffer aNewBuffer = static_cast<Graphic3d_PtrFrameBuffer> (aCView->ptrFBO);
-        aView->View()->FBORelease (aNewBuffer);
-        aCView->ptrFBO = anOldBuffer;
+        aGraphicView->FBORelease (aNewBuffer);
+        aGraphicView->SetFBO (anOldBuffer);
       }
       else
       {
@@ -4345,7 +4386,7 @@ static int VPrintView (Draw_Interpretor& di, Standard_Integer argc,
       }
     }
 
-    // succesfully printed into an intermediate buffer
+    // successfully printed into an intermediate buffer
     if (isPrinted)
     {
       Image_PixMap aWrapper;
@@ -4606,139 +4647,67 @@ static int VZLayer (Draw_Interpretor& di, Standard_Integer argc, const char** ar
   return 0;
 }
 
-// this class provides a presentation of text item in v3d view under-/overlayer
-class V3d_TextItem : public Visual3d_LayerItem
-{
-public:
-
-  // CASCADE RTTI
-  DEFINE_STANDARD_RTTI(V3d_TextItem, Visual3d_LayerItem)
-
-  // constructor
-  Standard_EXPORT V3d_TextItem(const TCollection_AsciiString& theText,
-                               const Standard_Real theX1,
-                               const Standard_Real theY1,
-                               const Standard_Real theHeight,
-                               const TCollection_AsciiString& theFontName,
-                               const Quantity_Color& theColor,
-                               const Quantity_Color& theSubtitleColor,
-                               const Aspect_TypeOfDisplayText& theTypeOfDisplay,
-                               const Handle(Visual3d_Layer)& theLayer);
-
-  // redraw method
-  Standard_EXPORT void RedrawLayerPrs();
-
-private:
-
-  Standard_Real            myX1;
-  Standard_Real            myY1;
-  TCollection_AsciiString  myText;
-  Standard_Real            myHeight;
-  Handle(Visual3d_Layer)   myLayer;
-  Quantity_Color           myColor;
-  Quantity_Color           mySubtitleColor;
-  Aspect_TypeOfDisplayText myType;
-  TCollection_AsciiString  myFontName;
-};
-
-
-// create and add to display the text item
-V3d_TextItem::V3d_TextItem (const TCollection_AsciiString& theText,
-                            const Standard_Real theX1,
-                            const Standard_Real theY1,
-                            const Standard_Real theHeight,
-                            const TCollection_AsciiString& theFontName,
-                            const Quantity_Color& theColor,
-                            const Quantity_Color& theSubtitleColor,
-                            const Aspect_TypeOfDisplayText& theTypeOfDisplay,
-                            const Handle(Visual3d_Layer)& theLayer)
- : myX1 (theX1), myY1 (theY1),
-   myText (theText),
-   myHeight (theHeight),
-   myLayer (theLayer),
-   myColor (theColor),
-   mySubtitleColor (theSubtitleColor),
-   myType (theTypeOfDisplay),
-   myFontName (theFontName)
-{
-  if (!myLayer.IsNull ())
-    myLayer->AddLayerItem (this);
-}
-
-// render item
-void V3d_TextItem::RedrawLayerPrs ()
-{
-  if (myLayer.IsNull ())
-    return;
-
-  myLayer->SetColor (myColor);
-  myLayer->SetTextAttributes (myFontName.ToCString (), myType, mySubtitleColor);
-  myLayer->DrawText (myText.ToCString (), myX1, myY1, myHeight);
-}
-
-// The Visual3d_LayerItem line item for "vlayerline" command
-// it provides a presentation of line with user-defined
-// linewidth, linetype and transparency.
-class V3d_LineItem : public Visual3d_LayerItem
+// The interactive presentation of 2d layer item
+// for "vlayerline" command it provides a presentation of
+// line with user-defined linewidth, linetype and transparency.
+class V3d_LineItem : public AIS_InteractiveObject
 {
 public:
   // CASCADE RTTI
-  DEFINE_STANDARD_RTTI(V3d_LineItem, Visual3d_LayerItem)
+  DEFINE_STANDARD_RTTI(V3d_LineItem, AIS_InteractiveObject)
 
   // constructor
   Standard_EXPORT V3d_LineItem(Standard_Real X1, Standard_Real Y1,
                                Standard_Real X2, Standard_Real Y2,
-                               V3d_LayerMgrPointer theLayerMgr,
                                Aspect_TypeOfLine theType = Aspect_TOL_SOLID,
                                Standard_Real theWidth    = 0.5,
                                Standard_Real theTransp   = 1.0);
 
-  // redraw method
-  Standard_EXPORT   void RedrawLayerPrs();
+  private:
+
+  void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                const Handle(Prs3d_Presentation)& thePresentation,
+                const Standard_Integer theMode) Standard_OVERRIDE;
+
+  void ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
+                         const Standard_Integer /*aMode*/) Standard_OVERRIDE
+  {}
 
 private:
 
   Standard_Real       myX1, myY1, myX2, myY2;
-  V3d_LayerMgrPointer myLayerMgr;
   Aspect_TypeOfLine   myType;
   Standard_Real       myWidth;
-  Standard_Real       myTransparency;
 };
 
-
 // default constructor for line item
 V3d_LineItem::V3d_LineItem(Standard_Real X1, Standard_Real Y1,
                            Standard_Real X2, Standard_Real Y2,
-                           V3d_LayerMgrPointer theLayerMgr,
                            Aspect_TypeOfLine theType,
                            Standard_Real theWidth,
                            Standard_Real theTransp) :
-  myX1(X1), myY1(Y1), myX2(X2), myY2(Y2), myLayerMgr(theLayerMgr),
-  myType(theType), myWidth(theWidth), myTransparency(theTransp)
+  myX1(X1), myY1(Y1), myX2(X2), myY2(Y2),
+  myType(theType), myWidth(theWidth)
 {
-  if (myLayerMgr && !myLayerMgr->Overlay().IsNull())
-    myLayerMgr->Overlay()->AddLayerItem (this);
+  SetTransparency (1-theTransp);
 }
 
 // render line
-void V3d_LineItem::RedrawLayerPrs ()
+void V3d_LineItem::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/,
+                            const Handle(Prs3d_Presentation)& thePresentation,
+                            const Standard_Integer /*theMode*/)
 {
-  Handle (Visual3d_Layer) aOverlay;
-
-  if (myLayerMgr)
-    aOverlay = myLayerMgr->Overlay();
-
-  if (!aOverlay.IsNull())
-  {
-    Quantity_Color aColor(1.0, 0, 0, Quantity_TOC_RGB);
-    aOverlay->SetColor(aColor);
-    aOverlay->SetTransparency((Standard_ShortReal)myTransparency);
-    aOverlay->SetLineAttributes((Aspect_TypeOfLine)myType, myWidth);
-    aOverlay->BeginPolyline();
-    aOverlay->AddVertex(myX1, myY1);
-    aOverlay->AddVertex(myX2, myY2);
-    aOverlay->ClosePrimitive();
-  }
+  thePresentation->Clear();
+  Quantity_Color aColor (1.0, 0, 0, Quantity_TOC_RGB);
+  Standard_Integer aWidth, aHeight;
+  ViewerTest::CurrentView()->Window()->Size (aWidth, aHeight);
+  Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
+  Handle(Graphic3d_ArrayOfPolylines) aPrim = new Graphic3d_ArrayOfPolylines(5);
+  aPrim->AddVertex(myX1, aHeight-myY1, 0.);
+  aPrim->AddVertex(myX2, aHeight-myY2, 0.);
+  Handle(Prs3d_LineAspect) anAspect = new Prs3d_LineAspect (aColor, (Aspect_TypeOfLine)myType, myWidth);
+  aGroup->SetPrimitivesAspect (anAspect->Aspect());
+  aGroup->AddPrimitiveArray (aPrim);
 }
 
 //=============================================================================
@@ -4770,6 +4739,7 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char**
     return 1;
   }
 
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
   // get the input params
   Standard_Real X1 = Draw::Atof(argv[1]);
   Standard_Real Y1 = Draw::Atof(argv[2]);
@@ -4816,122 +4786,24 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char**
       aLineType = Aspect_TOL_SOLID;
   }
 
-  // replace layer manager
-  Handle(V3d_LayerMgr) aMgr = new V3d_LayerMgr(aView);
-  aView->SetLayerMgr(aMgr);
-
-  // add line item
-  Handle (V3d_LineItem) anItem = new V3d_LineItem(X1, Y1, X2, Y2,
-                                                  aMgr.operator->(),
-                                                  aLineType, aWidth,
-                                                  aTransparency);
-
-  // update view
-  aView->MustBeResized();
-  aView->Redraw();
-
-  return 0;
-}
-
-//=======================================================================
-//function : VOverlayText
-//purpose  : Test text displaying in view overlay
-//=======================================================================
-static int VOverlayText (Draw_Interpretor& di, Standard_Integer argc, const char**argv)
-{
-  // get the active view
-  Handle(V3d_View) aView = ViewerTest::CurrentView();
-  if (aView.IsNull())
-  {
-    di << "No active view. Please call vinit.\n";
-    return 1;
-  }
-  else if (argc < 4 || argc > 13)
-  {
-    di << "Use: " << argv[0];
-    di << " text x y [height] [font_name] [text_color: R G B] [displayType]\n";
-    di << "[background_color: R G B]\n";
-    di << "  height - pixel height of the text (default=10.0)\n";
-    di << "  font_name - name of font (default=courier)\n";
-    di << "  text_color - R G B values of text color (default=255.0 255.0 255.0)\n";
-    di << "  display_type = {normal/subtitle/decal/blend/dimension}, (default=normal)\n";
-    di << "  background_color- R G B values used for subtitle and decal text\n";
-    di << "(default=255.0 255.0 255.0)\n";
-    return 1;
-  }
-
-  TCollection_AsciiString aText (argv[1]);
-  Standard_Real aPosX = Draw::Atof(argv[2]);
-  Standard_Real aPosY = Draw::Atof(argv[3]);
-  Standard_Real aHeight = (argc >= 5) ? Draw::Atof (argv[4]) : 10.0;
-
-  // font name
-  TCollection_AsciiString aFontName = "Courier";
-  if (argc >= 6)
-    aFontName = TCollection_AsciiString (argv[5]);
-
-  // text colors
-  Quantity_Parameter aColorRed   = 1.0;
-  Quantity_Parameter aColorGreen = 1.0;
-  Quantity_Parameter aColorBlue  = 1.0;
-  if (argc >= 9)
-  {
-    aColorRed   = Draw::Atof (argv[6])/255.;
-    aColorGreen = Draw::Atof (argv[7])/255.;
-    aColorBlue  = Draw::Atof (argv[8])/255.;
-  }
-
-  // display type
-  TCollection_AsciiString aDispStr;
-  if (argc >= 10)
-    aDispStr = TCollection_AsciiString (argv[9]);
-
-  Aspect_TypeOfDisplayText aTextType = Aspect_TODT_NORMAL;
-  if (aDispStr.IsEqual ("subtitle"))
-    aTextType = Aspect_TODT_SUBTITLE;
-  else if (aDispStr.IsEqual ("decal"))
-    aTextType = Aspect_TODT_DEKALE;
-  else if (aDispStr.IsEqual ("blend"))
-    aTextType = Aspect_TODT_BLEND;
-  else if (aDispStr.IsEqual ("dimension"))
-    aTextType = Aspect_TODT_DIMENSION;
-
-  // subtitle color
-  Quantity_Parameter aSubRed   = 1.0;
-  Quantity_Parameter aSubGreen = 1.0;
-  Quantity_Parameter aSubBlue  = 1.0;
-  if (argc == 13)
+  static Handle (V3d_LineItem) aLine;
+  if (!aLine.IsNull())
   {
-    aSubRed   = Draw::Atof (argv[10])/255.;
-    aSubGreen = Draw::Atof (argv[11])/255.;
-    aSubBlue  = Draw::Atof (argv[12])/255.;
+    aContext->Erase (aLine);
   }
+  aLine = new V3d_LineItem (X1, Y1, X2, Y2,
+                            aLineType, aWidth,
+                            aTransparency);
 
-  // check fo current overlay
-  Handle(Visual3d_Layer) anOverlay = aView->Viewer()->Viewer()->OverLayer ();
-  if (anOverlay.IsNull ())
-  {
-    Handle(V3d_LayerMgr) aMgr = new V3d_LayerMgr (aView);
-    anOverlay = aMgr->Overlay ();
-    aView->SetLayerMgr (aMgr);
-  }
-
-  Quantity_Color aTextColor (aColorRed, aColorGreen,
-    aColorBlue, Quantity_TOC_RGB);
-  Quantity_Color aSubtColor (aSubRed, aSubGreen,
-    aSubBlue, Quantity_TOC_RGB);
-
-  // add text item
-  Handle(V3d_TextItem) anItem = new V3d_TextItem (aText, aPosX, aPosY,
-    aHeight, aFontName, aTextColor, aSubtColor, aTextType, anOverlay);
-
-  // update view
-  aView->MustBeResized();
-  aView->Redraw();
+  aLine->SetTransformPersistence (Graphic3d_TMF_2d,gp_Pnt(-1,-1,0));
+  aLine->SetZLayer (Graphic3d_ZLayerId_TopOSD);
+  aLine->SetToUpdate();
+  aContext->Display (aLine, Standard_True);
 
   return 0;
 }
 
+
 //==============================================================================
 //function : VGrid
 //purpose  :
@@ -5375,7 +5247,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
     {
       Standard_Boolean toShowWarns = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toShowWarns))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toShowWarns))
       {
         --anArgIter;
       }
@@ -5391,7 +5263,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
     {
       Standard_Boolean toShow = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toShow))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toShow))
       {
         --anArgIter;
       }
@@ -5407,7 +5279,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
     {
       Standard_Boolean toSuppress = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toSuppress))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toSuppress))
       {
         --anArgIter;
       }
@@ -5421,7 +5293,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
     {
       Standard_Boolean toSync = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toSync))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toSync))
       {
         --anArgIter;
       }
@@ -5434,13 +5306,13 @@ static int VGlDebug (Draw_Interpretor& theDI,
     else if (anArgCase == "-debug")
     {
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnableDebug))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnableDebug))
       {
         --anArgIter;
       }
       aDefCaps->contextDebug = toEnableDebug;
     }
-    else if (parseOnOff (anArg, toEnableDebug)
+    else if (ViewerTest::ParseOnOff (anArg, toEnableDebug)
           && (anArgIter + 1 == theArgNb))
     {
       // simple alias to turn on almost everything
@@ -5545,7 +5417,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5555,7 +5427,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5565,7 +5437,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5576,7 +5448,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5586,7 +5458,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5597,7 +5469,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5610,7 +5482,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5625,7 +5497,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -5640,7 +5512,7 @@ static int VCaps (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -7186,7 +7058,7 @@ static int VAutoZFit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const
     return 1;
   }
 
-  Standard_Real aScale = aCurrentView->View()->AutoZFitScaleFactor();
+  Standard_Real aScale = aCurrentView->AutoZFitScaleFactor();
 
   if (theArgsNb > 3)
   {
@@ -7197,7 +7069,7 @@ static int VAutoZFit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const
   if (theArgsNb < 2)
   {
     theDi << "Auto z-fit mode: " << "\n"
-          << "On: " << (aCurrentView->View()->AutoZFitMode() ? "enabled" : "disabled") << "\n"
+          << "On: " << (aCurrentView->AutoZFitMode() ? "enabled" : "disabled") << "\n"
           << "Scale: " << aScale << "\n";
     return 0;
   }
@@ -7209,8 +7081,8 @@ static int VAutoZFit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const
     aScale = Draw::Atoi (theArgVec[2]);
   }
 
-  aCurrentView->View()->SetAutoZFitMode (isOn, aScale);
-  aCurrentView->View()->AutoZFit();
+  aCurrentView->SetAutoZFitMode (isOn, aScale);
+  aCurrentView->AutoZFit();
   aCurrentView->Redraw();
 
   return 0;
@@ -7424,7 +7296,7 @@ static int VCamera (Draw_Interpretor& theDI,
     }
   }
 
-  aView->View()->AutoZFit();
+  aView->AutoZFit();
   aView->Redraw();
 
   return 0;
@@ -7538,6 +7410,33 @@ static int VStereo (Draw_Interpretor& theDI,
 
     Standard_Boolean isActive = ViewerTest_myDefaultCaps.contextStereo;
     theDI << "Stereo " << (isActive ? "ON" : "OFF") << "\n";
+    if (isActive)
+    {
+      TCollection_AsciiString aMode;
+      switch (aView->RenderingParams().StereoMode)
+      {
+        case Graphic3d_StereoMode_QuadBuffer       : aMode = "quadBuffer";       break;
+        case Graphic3d_StereoMode_RowInterlaced    : aMode = "rowInterlaced";    break;
+        case Graphic3d_StereoMode_ColumnInterlaced : aMode = "columnInterlaced"; break;
+        case Graphic3d_StereoMode_ChessBoard       : aMode = "chessBoard";       break;
+        case Graphic3d_StereoMode_SideBySide       : aMode = "sideBySide";       break;
+        case Graphic3d_StereoMode_OverUnder        : aMode = "overUnder";        break;
+        case Graphic3d_StereoMode_SoftPageFlip     : aMode = "softpageflip";     break;
+        case Graphic3d_StereoMode_Anaglyph  :
+          aMode = "anaglyph";
+          switch (aView->RenderingParams().AnaglyphFilter)
+          {
+            case Graphic3d_RenderingParams::Anaglyph_RedCyan_Simple      : aMode.AssignCat (" (redCyanSimple)");      break;
+            case Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized   : aMode.AssignCat (" (redCyan)");            break;
+            case Graphic3d_RenderingParams::Anaglyph_YellowBlue_Simple   : aMode.AssignCat (" (yellowBlueSimple)");   break;
+            case Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized: aMode.AssignCat (" (yellowBlue)");         break;
+            case Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple : aMode.AssignCat (" (greenMagentaSimple)"); break;
+            default: break;
+          }
+        default: break;
+      }
+      theDI << "Mode " << aMode << "\n";
+    }
     return 0;
   }
 
@@ -7600,7 +7499,7 @@ static int VStereo (Draw_Interpretor& theDI,
     {
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -7611,7 +7510,7 @@ static int VStereo (Draw_Interpretor& theDI,
     {
       Standard_Boolean toDisable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toDisable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toDisable))
       {
         --anArgIter;
       }
@@ -8371,10 +8270,11 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
       case Graphic3d_RM_RAYTRACING:    theDI << "raytrace ";      break;
     }
     theDI << "\n";
+    theDI << "msaa:         " <<  aParams.NbMsaaSamples << "\n";
+    theDI << "rayDepth:     " <<  aParams.RaytracingDepth                             << "\n";
     theDI << "fsaa:         " << (aParams.IsAntialiasingEnabled       ? "on" : "off") << "\n";
     theDI << "shadows:      " << (aParams.IsShadowEnabled             ? "on" : "off") << "\n";
     theDI << "reflections:  " << (aParams.IsReflectionEnabled         ? "on" : "off") << "\n";
-    theDI << "rayDepth:     " <<  aParams.RaytracingDepth                             << "\n";
     theDI << "gleam:        " << (aParams.IsTransparentShadowEnabled  ? "on" : "off") << "\n";
     theDI << "GI:           " << (aParams.IsGlobalIlluminationEnabled ? "on" : "off") << "\n";
     theDI << "blocked RNG:  " << (aParams.CoherentPathTracingMode     ? "on" : "off") << "\n";
@@ -8449,6 +8349,30 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       aParams.Method = Graphic3d_RM_RASTERIZATION;
     }
+    else if (aFlag == "-msaa")
+    {
+      if (toPrint)
+      {
+        theDI << aParams.NbMsaaSamples << " ";
+        continue;
+      }
+      else if (++anArgIter >= theArgNb)
+      {
+        std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+        return 1;
+      }
+
+      const Standard_Integer aNbSamples = Draw::Atoi (theArgVec[anArgIter]);
+      if (aNbSamples < 0)
+      {
+        std::cerr << "Error: invalid number of MSAA samples " << aNbSamples << ".\n";
+        return 1;
+      }
+      else
+      {
+        aParams.NbMsaaSamples = aNbSamples;
+      }
+    }
     else if (aFlag == "-raydepth"
           || aFlag == "-ray_depth")
     {
@@ -8487,7 +8411,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8504,7 +8428,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8520,7 +8444,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8536,7 +8460,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8552,7 +8476,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-      && !parseOnOff (theArgVec[anArgIter], toEnable))
+      && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8573,7 +8497,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-        && !parseOnOff (theArgVec[anArgIter], toEnable))
+        && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8589,7 +8513,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
 
       Standard_Boolean toEnable = Standard_True;
       if (++anArgIter < theArgNb
-        && !parseOnOff (theArgVec[anArgIter], toEnable))
+        && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
       {
         --anArgIter;
       }
@@ -8647,6 +8571,25 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
         return 1;
       }
     }
+    else if (aFlag == "-resolution")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+        return 1;
+      }
+
+      TCollection_AsciiString aResolution (theArgVec[anArgIter]);
+      if (aResolution.IsIntegerValue())
+      {
+        aView->ChangeRenderingParams().Resolution = static_cast<unsigned int> (Draw::Atoi (aResolution.ToCString()));
+      }
+      else
+      {
+        std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+        return 1;
+      }
+    }
     else
     {
       std::cout << "Error: wrong syntax, unknown flag '" << anArg << "'\n";
@@ -8911,25 +8854,25 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "vhelp            : display help on the viewer commands",
     __FILE__,VHelp,group);
   theCommands.Add("vtop" ,
-    "vtop or <T>      : Top view" ,
+    "vtop or <T>      : Top view. Orientation +X+Y" ,
     __FILE__,VTop,group);
   theCommands.Add("vbottom" ,
-    "vbottom          : Bottom view" ,
+    "vbottom          : Bottom view. Orientation +X-Y" ,
     __FILE__,VBottom,group);
   theCommands.Add("vleft" ,
-    "vleft            : Left view" ,
+    "vleft            : Left view. Orientation -Y+Z" ,
     __FILE__,VLeft,group);
   theCommands.Add("vright" ,
-    "vright           : Right view" ,
+    "vright           : Right view. Orientation +Y+Z" ,
     __FILE__,VRight,group);
   theCommands.Add("vaxo" ,
-    " vaxo or <A>     : Axonometric view ",
+    " vaxo or <A>     : Axonometric view. Orientation +X-Y+Z",
     __FILE__,VAxo,group);
   theCommands.Add("vfront" ,
-    "vfront           : Front view" ,
+    "vfront           : Front view. Orientation +X+Z" ,
     __FILE__,VFront,group);
   theCommands.Add("vback" ,
-    "vback            : Back view" ,
+    "vback            : Back view. Orientation -X+Z" ,
     __FILE__,VBack,group);
   theCommands.Add("vpick" ,
     "vpick           : vpick X Y Z [shape subshape] ( all variables as string )",
@@ -8952,7 +8895,8 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "vrepaint        : vrepaint, force redraw",
     __FILE__,VRepaint,group);
   theCommands.Add("vclear",
-    "vclear          : vclear",
+    "vclear          : vclear"
+    "\n\t\t: remove all the object from the viewer",
     __FILE__,VClear,group);
   theCommands.Add("vsetbg",
     "vsetbg          : vsetbg imagefile [filltype] : Load image as background",
@@ -9004,7 +8948,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     " : notice that EMF format requires patched gl2ps",
     __FILE__,VExport,group);
   theCommands.Add("vcolorscale",
-    "vcolorscale     : vcolorscale [-range RangeMin = 0 RangeMax = 100 Intervals = 10 -font HeightFont = 16  -textpos "
+    "vcolorscale     : vcolorscale name [-range RangeMin = 0 RangeMax = 100 Intervals = 10 -font HeightFont = 16  -textpos "
     "Position = left -xy X = 0 Y = 0] [-noupdate|-update]: draw color scale\n"
     "-demo/-demoversion draw a demoversion of color scale.\n"
     "-show/display display color scale.\n"
@@ -9063,14 +9007,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "   vzlayer disable depthtest 1\n"
     "   vzlayer del 1\n",
     __FILE__,VZLayer,group);
-  theCommands.Add("voverlaytext",
-    "voverlaytext : text x y [height] [font_name] [text_color: R G B] [display_type] [background_color: R G B]"
-    " : height - pixel height of the text (default=10.0)"
-    " : font_name - name of font (default=courier)"
-    " : text_color - three values: RedColor GreenColor BlueColor (default = 255.0 255.0 255.0) "
-    " : display_type = {normal/subtitle/decal/blend}, (default=normal) "
-    " : background_color - three values: RedColor GreenColor BlueColor (default = 255.0 255.0 255.0), the parameter is defined for subtitle and decal display types ",
-    __FILE__,VOverlayText,group);
   theCommands.Add("vlayerline",
     "vlayerline : vlayerline x1 y1 x2 y2 [linewidth=0.5] [linetype=0] [transparency=1.0]",
     __FILE__,VLayerLine,group);
@@ -9142,7 +9078,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     __FILE__, VStereo, group);
   theCommands.Add ("vcaps",
             "vcaps [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}]"
-    "\n\t\t:       [-compatibleContext {0|1}]"
+    "\n\t\t:       [-compatibleProfile {0|1}]"
     "\n\t\t:       [-vsync {0|1}]"
     "\n\t\t:       [-quadBuffer {0|1}] [-stereo {0|1}]"
     "\n\t\t:       [-softMode {0|1}] [-noupdate|-update]"
@@ -9180,7 +9116,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "- 1) single click selection\n"
     "- 2) selection with rectangle having corners at pixel positions (x1,y1) and (x2,y2)\n"
     "- 3) selection with polygon having corners in pixel positions (x1,y1), (x2,y2),...,(xn,yn)\n"
-    "- 4) -allowoverlap determines will partially included objects be selected in rectangular selection"
+    "- 4) -allowoverlap manages overlap and inclusion detection in rectangular selection.\n"
+    "     If the flag is set to 1, both sensitives that were included completely and overlapped partially by defined rectangle will be detected,\n"
+    "     otherwise algorithm will chose only fully included sensitives. Default behavior is to detect only full inclusion. "
     " (partial inclusion - overlap - is not allowed by default)\n"
     "- 5) any of these selections with shift button pressed",
     __FILE__, VSelect, group);
@@ -9214,7 +9152,8 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "- gets or sets ZClipping mode, width and depth",
     __FILE__,VZClipping,group);
   theCommands.Add ("vnbselected",
-    "vnbselected", __FILE__, VNbSelected, group);
+    "vnbselected"
+    "\n\t\t: Returns number of selected objects", __FILE__, VNbSelected, group);
   theCommands.Add ("vcamera",
               "vcamera [-ortho] [-projtype]"
       "\n\t\t:         [-persp]"
@@ -9250,7 +9189,8 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "   vzrange [znear] [zfar] - applies provided values to view",
     __FILE__,VZRange, group);
   theCommands.Add("vantialiasing",
-    "vantialiasing 1|0",
+    "vantialiasing 1|0"
+    "\n\t\t: Switches altialiasing on or off",
     __FILE__,VAntialiasing,group);
   theCommands.Add ("vpurgedisplay",
     "vpurgedisplay"
@@ -9358,8 +9298,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     __FILE__, VRenderParams, group);
   theCommands.Add("vrenderparams",
     "\n    Manages rendering parameters: "
-    "\n      '-rayTrace'             Enables  GPU ray-tracing"
     "\n      '-raster'               Disables GPU ray-tracing"
+    "\n      '-msaa         0..4'    Specifies number of samples for MSAA"
+    "\n      '-rayTrace'             Enables  GPU ray-tracing"
     "\n      '-rayDepth     0..10'   Defines maximum ray-tracing depth"
     "\n      '-shadows      on|off'  Enables/disables shadows rendering"
     "\n      '-reflections  on|off'  Enables/disables specular reflections"
@@ -9370,6 +9311,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "\n      '-env          on|off'  Enables/disables environment map background"
     "\n      '-shadingModel model'   Controls shading model from enumeration"
     "\n                              color, flat, gouraud, phong"
+    "\n      '-resolution   value'   Sets a new pixels density (PPI), defines scaling factor for parameters like text size"
     "\n    Unlike vcaps, these parameters dramatically change visual properties."
     "\n    Command is intended to control presentation quality depending on"
     "\n    hardware capabilities and performance.",