0027360: Visualization - remove obsolete anti-aliasing API
authorkgv <kgv@opencascade.com>
Sat, 30 Jul 2016 14:54:29 +0000 (17:54 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 4 Aug 2016 08:34:25 +0000 (11:34 +0300)
The methods V3d_View::SetAntialiasingOn(), ::SetAntialiasingOff()
and Antialiasing() have been removed.

16 files changed:
dox/dev_guides/upgrade/upgrade.md
dox/user_guides/draw_test_harness/draw_test_harness.md
samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp
src/Graphic3d/Graphic3d_CView.cxx
src/Graphic3d/Graphic3d_CView.hxx
src/OpenGl/OpenGl_NamedStatus.hxx
src/OpenGl/OpenGl_View.cxx
src/OpenGl/OpenGl_View.hxx
src/OpenGl/OpenGl_View_Redraw.cxx
src/OpenGl/OpenGl_Workspace.cxx
src/OpenGl/OpenGl_Workspace.hxx
src/QABugs/QABugs_3.cxx
src/V3d/V3d_View.cxx
src/V3d/V3d_View.hxx
src/V3d/V3d_View_1.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx

index 8e31eb3..899cb15 100644 (file)
@@ -1010,3 +1010,10 @@ Graphic3d_Group::SetGroupPrimitivesAspect() should be the main method defining p
 The implementation of Graphic3d_Group::SetGroupPrimitivesAspect() has been changed from copying aspect values to keeping passed object.
 Although it was not documented, previosly it was possible to modify single aspects instance (like Graphic3d_AspectFillArea3d) and set it to multiple groups.
 Now such code would produce unexpected result and therefore should be updated to create dedicated aspect instance.
+
+@subsection upgrade_710_removed Removed features
+
+The following obsolete features have been removed:
+
+* Obsolete Antialiasing API V3d_View::SetAntialiasingOn(). This method was intended to activate deprecated OpenGL functionality (GL_POLYGON_SMOOTH, GL_LINE_SMOOTH, GL_POINT_SMOOTH).
+  Instead of old API, application should request MSAA buffers for antialiasing by assigning Graphic3d_RenderingParams::NbMsaaSamples property of structure returned by V3d_View::ChangeRenderingParams().
index 688a3a8..2a5314b 100644 (file)
@@ -1461,14 +1461,6 @@ vnbselected
 ~~~~~
 Returns the number of selected objects in the interactive context.
 
-@subsubsection occt_draw_4_2_17  vantialiasing
-
-Syntax:     
-~~~~~
-vantialiasing 1|0
-~~~~~
-Sets antialiasing if the command is called with 1 or unsets otherwise.
-
 @subsubsection occt_draw_4_2_18  vpurgedisplay
 
 Syntax:     
index 85e697d..0545bf9 100755 (executable)
@@ -1036,18 +1036,13 @@ GetDocument()->UpdateResultMessageDlg("SetShadingModel",Message);
 
 void CViewer3dView::OnAntialiasingonoff() 
 {
-       if(!myView->Antialiasing())
-               myView->SetAntialiasingOn();
-       else
-               myView->SetAntialiasingOff();
-
+  Graphic3d_RenderingParams& aParams = myView->ChangeRenderingParams();
+  aParams.NbMsaaSamples = aParams.NbMsaaSamples == 0 ? 8 : 0;
        myView->Update();
 
 TCollection_AsciiString Message("\
-if(!myView->Antialiasing())\n\
-       myView->SetAntialiasingOn();\n\
-else\n\
-       myView->SetAntialiasingOff();\n\
+Graphic3d_RenderingParams& aParams = myView->ChangeRenderingParams();\n\
+aParams.NbMsaaSamples = aParams.NbMsaaSamples == 0 ? 8 : 0;\n\
   ");
 
   // Update The Result Message Dialog
index f9125a7..a3428f4 100644 (file)
@@ -1140,7 +1140,6 @@ Standard_Integer Graphic3d_CView::HaveTheSameOwner (const Handle(Graphic3d_Struc
 void Graphic3d_CView::CopySettings (const Handle(Graphic3d_CView)& theOther)
 {
   ChangeRenderingParams() = theOther->RenderingParams();
-  SetAntialiasingEnabled   (theOther->IsAntialiasingEnabled());
   SetBackground            (theOther->Background());
   SetGradientBackground    (theOther->GradientBackground());
   SetBackgroundImage       (theOther->BackgroundImage());
index 4140048..520acac 100644 (file)
@@ -402,12 +402,6 @@ public:
   //! Returns reference to current rendering parameters and effect settings.
   Graphic3d_RenderingParams& ChangeRenderingParams() { return myRenderParams; }
 
-  //! Returns true if anti-aliasing is enabled for the view.
-  virtual Standard_Boolean IsAntialiasingEnabled() const = 0;
-
-  //! Enable or disable anti-aliasing in the view.
-  virtual void SetAntialiasingEnabled (const Standard_Boolean theIsEnabled) = 0;
-
   //! Returns background  fill color.
   virtual Aspect_Background Background() const = 0;
 
index 65af7bb..120c80c 100644 (file)
@@ -19,7 +19,6 @@
 // Dynamic fields
 #define OPENGL_NS_RESMAT       (1<<2)
 #define OPENGL_NS_TEXTURE      (1<<4)
-#define OPENGL_NS_ANTIALIASING (1<<5)
 #define OPENGL_NS_2NDPASSNEED  (1<<6)
 #define OPENGL_NS_2NDPASSDO    (1<<7)
 #define OPENGL_NS_WHITEBACK    (1<<8)
index 39037a7..9d56008 100644 (file)
@@ -62,7 +62,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
   myCaps           (theCaps),
   myDeviceLostFlag (theDeviceLostFlag),
   myWasRedrawnGL   (Standard_False),
-  myAntiAliasing   (Standard_False),
   myCulling        (Standard_True),
   myShadingModel   (Graphic3d_TOSM_FACET),
   myBackfacing     (Graphic3d_TOBM_AUTOMATIC),
@@ -96,14 +95,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
 {
   myWorkspace = new OpenGl_Workspace (this, NULL);
 
-  // AA mode
-  const char* anAaEnv = ::getenv ("CALL_OPENGL_ANTIALIASING_MODE");
-  if (anAaEnv != NULL)
-  {
-    int v;
-    if (sscanf (anAaEnv, "%d", &v) > 0) myAntiAliasing = v;
-  }
-
   OpenGl_Light       aLight;
   aLight.Type        = Graphic3d_TOLS_AMBIENT;
   aLight.IsHeadlight = Standard_False;
index 2d51c1f..a46a6db 100644 (file)
@@ -273,12 +273,6 @@ public:
 
 public:
 
-  //! Returns true if anti-aliasing is enabled for the view.
-  Standard_Boolean virtual IsAntialiasingEnabled() const Standard_OVERRIDE { return myAntiAliasing; }
-
-  //! Enable or disable anti-aliasing in the view.
-  virtual void SetAntialiasingEnabled (const Standard_Boolean theIsEnabled) Standard_OVERRIDE { myAntiAliasing = theIsEnabled; }
-
   //! Returns background  fill color.
   Standard_EXPORT virtual Aspect_Background Background() const Standard_OVERRIDE;
 
@@ -563,7 +557,6 @@ protected:
   Standard_Boolean&        myDeviceLostFlag;
   Standard_Boolean         myWasRedrawnGL;
 
-  Standard_Boolean                myAntiAliasing;
   Standard_Boolean                myCulling;
   Graphic3d_TypeOfShadingModel    myShadingModel;
   Graphic3d_TypeOfBackfacingModel myBackfacing;
index e6be3c8..78af8c7 100644 (file)
@@ -922,13 +922,6 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
 #endif
 
   aManager->SetShadingModel (myShadingModel);
-
-  // Apply AntiAliasing
-  if (myAntiAliasing)
-    myWorkspace->NamedStatus |= OPENGL_NS_ANTIALIASING;
-  else
-    myWorkspace->NamedStatus &= ~OPENGL_NS_ANTIALIASING;
-
   if (!aManager->IsEmpty())
   {
     aManager->UpdateClippingState();
@@ -1022,40 +1015,6 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
     return;
 
   Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
-  if ( (myWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
-  {
-  #if !defined(GL_ES_VERSION_2_0)
-    const int anAntiAliasingMode = myWorkspace->AntiAliasingMode();
-  #endif
-
-    if ( !myAntiAliasing )
-    {
-    #if !defined(GL_ES_VERSION_2_0)
-      if (aCtx->core11 != NULL)
-      {
-        glDisable (GL_POINT_SMOOTH);
-      }
-      glDisable(GL_LINE_SMOOTH);
-      if( anAntiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
-    #endif
-      glBlendFunc (GL_ONE, GL_ZERO);
-      glDisable (GL_BLEND);
-    }
-    else
-    {
-    #if !defined(GL_ES_VERSION_2_0)
-      if (aCtx->core11 != NULL)
-      {
-        glEnable(GL_POINT_SMOOTH);
-      }
-      glEnable(GL_LINE_SMOOTH);
-      if( anAntiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
-    #endif
-      glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-      glEnable (GL_BLEND);
-    }
-  }
-
   Standard_Boolean toRenderGL = theToDrawImmediate ||
     myRenderParams.Method != Graphic3d_RM_RAYTRACING ||
     myRaytraceInitStatus == OpenGl_RT_FAIL ||
index 94c661c..0a4e3f5 100644 (file)
@@ -655,11 +655,8 @@ void OpenGl_Workspace::updateMaterial (const int theFlag)
     else
     {
       // render opaque
-      if ((NamedStatus & OPENGL_NS_ANTIALIASING) == 0)
-      {
-        glBlendFunc (GL_ONE, GL_ZERO);
-        glDisable   (GL_BLEND);
-      }
+      glBlendFunc (GL_ONE, GL_ZERO);
+      glDisable   (GL_BLEND);
       if (myUseDepthWrite)
       {
         glDepthMask (GL_TRUE);
@@ -1005,15 +1002,6 @@ Standard_Boolean OpenGl_Workspace::UseGLLight() const
   return myView->IsGLLightEnabled();
 }
 
-// =======================================================================
-// function : AntiAliasingMode
-// purpose  :
-// =======================================================================
-Standard_Integer OpenGl_Workspace::AntiAliasingMode() const
-{
-  return myView->IsAntialiasingEnabled();
-}
-
 // =======================================================================
 // function : IsCullingEnabled
 // purpose  :
index 519ec7d..7e40713 100644 (file)
@@ -162,9 +162,6 @@ public:
   //! @return true if usage of GL light is enabled.
   Standard_EXPORT Standard_Boolean  UseGLLight() const;
 
-  //! @return true if antialiasing is enabled.
-  Standard_EXPORT Standard_Integer AntiAliasingMode() const;
-
   //! @return true if clipping algorithm enabled
   Standard_EXPORT Standard_Boolean IsCullingEnabled() const;
 
@@ -362,7 +359,6 @@ protected: //! @name protected fields
   Handle(OpenGl_Context)           myGlContext;
   Handle(OpenGl_PrinterContext)    myPrintContext;
   Handle(OpenGl_LineAttributes)    myLineAttribs;
-  Standard_Integer                 myAntiAliasingMode;
   Standard_Boolean                 myUseZBuffer;
   Standard_Boolean                 myUseDepthWrite;
   Standard_Boolean                 myUseGLLight;
index f6f6454..8af72b2 100644 (file)
@@ -390,29 +390,6 @@ static Standard_Integer BUC60699(Draw_Interpretor& di, Standard_Integer /*n*/, c
   return 0;
 }
 
-static Standard_Integer GER61394(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
-{
-  if(argc > 2) {
-    di << "Usage : " << argv[0] << " [1/0]\n";
-    return -1;
-  }
-  
-  Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
-  if(myAIScontext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-  
-  if((argc == 2) && (Draw::Atof(argv[1]) == 0))
-    myV3dView->SetAntialiasingOff();
-  else
-    myV3dView->SetAntialiasingOn();
-  myV3dView->Update();
-  return 0;
-}
-
-
 #define DEFAULT_COLOR    Quantity_NOC_GOLDENROD
 
 //=======================================================================
@@ -1817,7 +1794,6 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) {
   theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group);
 
   theCommands.Add("BUC60699","BUC60699 ",__FILE__,BUC60699,group);
-  theCommands.Add("GER61394","GER61394 [1/0]",__FILE__,GER61394,group);
   theCommands.Add("GER61351","GER61351 name/object name/r g b/object r g b",__FILE__,setcolor,group);
   theCommands.Add("setcolor","setcolor name/object name/r g b/object r g b",__FILE__,setcolor,group);
 
index 9f7bed1..20012ad 100644 (file)
@@ -153,7 +153,6 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView th
   myDefaultCamera = new Graphic3d_Camera();
 
   myImmediateUpdate = Standard_False;
-  SetAntialiasingOff();
   SetAutoZFitMode (Standard_True, 1.0);
   SetBackFacingModel (V3d_TOBM_AUTOMATIC);
   SetCamera (aCamera);
@@ -2431,15 +2430,6 @@ V3d_TypeOfVisualization V3d_View::Visualization() const
   return static_cast<V3d_TypeOfVisualization> (myView->VisualizationType());
 }
 
-//=============================================================================
-//function : Antialiasing
-//purpose  :
-//=============================================================================
-Standard_Boolean V3d_View::Antialiasing() const
-{
-  return myView->IsAntialiasingEnabled();
-}
-
 //=============================================================================
 //function : Viewer
 //purpose  :
index a0a7827..52bc122 100644 (file)
@@ -102,8 +102,6 @@ DEFINE_STANDARD_HANDLE(V3d_View, MMgt_TShared)
 //! VIEWER application.
 //! The methods of this class allow the editing
 //! and inquiring the parameters linked to the view.
-//! (Projection,Mapping,Zclipping,DepthCueing,AntiAliasing
-//! et Conversions) .
 //! Provides a set of services common to all types of view.
 //! Warning: The default parameters are defined by the class
 //! Viewer (Example : SetDefaultViewSize()).
@@ -265,12 +263,6 @@ public:
   //! Defines the visualization type in the view.
   Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
 
-  //! Activates antialiasing in the view.
-  Standard_EXPORT void SetAntialiasingOn();
-
-  //! Deactivates antialiasing in the view.
-  Standard_EXPORT void SetAntialiasingOff();
-
   //! Defines the depth of the medium clipping plane.
   Standard_EXPORT void SetZClippingDepth (const Quantity_Length theDepth);
 
@@ -722,10 +714,6 @@ public:
   //! Returns the current visualisation mode.
   Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
 
-  //! Indicates if the antialiasing is active (True) or
-  //! inactive (False).
-  Standard_EXPORT Standard_Boolean Antialiasing() const;
-
   //! Returns activity and information on the Zcueing.
   //! <Depth> : Depth of plane.
   //! <Width> : Thickness around the plane.
index 21e2a48..bbe9887 100644 (file)
 #include <V3d_View.hxx>
 #include <V3d_Viewer.hxx>
 
-// =======================================================================
-// function : SetAntialiasingOn
-// purpose  :
-// =======================================================================
-void V3d_View::SetAntialiasingOn()
-{
-  myView->SetAntialiasingEnabled (Standard_True);
-}
-
-// =======================================================================
-// function : SetAntialiasingOff
-// purpose  :
-// =======================================================================
-void V3d_View::SetAntialiasingOff()
-{
-  myView->SetAntialiasingEnabled (Standard_False);
-}
-
 //=============================================================================
 //function : SetZClippingDepth
 //purpose  :
index 6d423e0..cb902fd 100644 (file)
@@ -6318,37 +6318,6 @@ static Standard_Integer VNbSelected (Draw_Interpretor& di,
   return 0;
 }
 
-//=======================================================================
-//function : VAntialiasing
-//purpose  : Switches altialiasing on or off
-//=======================================================================
-static Standard_Integer VAntialiasing (Draw_Interpretor& di,
-                                Standard_Integer argc,
-                                const char ** argv)
-{
-  if(argc > 2)
-  {
-    di << "Usage : " << argv[0] << " [1|0]\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull())
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  Handle(V3d_View) aView = ViewerTest::CurrentView();
-
-  if((argc == 2) && (atof(argv[1]) == 0))
-    aView->SetAntialiasingOff();
-  else
-    aView->SetAntialiasingOn();
-  aView->Update();
-  return 0;
-}
-
 //=======================================================================
 //function : VPurgeDisplay
 //purpose  : Switches altialiasing on or off
@@ -9524,10 +9493,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "   vzrange                - without parameters shows current values\n"
     "   vzrange [znear] [zfar] - applies provided values to view",
     __FILE__,VZRange, group);
-  theCommands.Add("vantialiasing",
-    "vantialiasing 1|0"
-    "\n\t\t: Switches altialiasing on or off",
-    __FILE__,VAntialiasing,group);
   theCommands.Add ("vpurgedisplay",
     "vpurgedisplay"
     "- removes structures which don't belong to objects displayed in neutral point",