From 2e5139af6bf344aa7d9ea2a2c2c139e292e79a71 Mon Sep 17 00:00:00 2001 From: kgv Date: Sat, 30 Jul 2016 17:54:29 +0300 Subject: [PATCH] 0027360: Visualization - remove obsolete anti-aliasing API The methods V3d_View::SetAntialiasingOn(), ::SetAntialiasingOff() and Antialiasing() have been removed. --- dox/dev_guides/upgrade/upgrade.md | 7 ++++ .../draw_test_harness/draw_test_harness.md | 8 ---- .../standard/04_Viewer3d/src/Viewer3dView.cpp | 13 ++---- src/Graphic3d/Graphic3d_CView.cxx | 1 - src/Graphic3d/Graphic3d_CView.hxx | 6 --- src/OpenGl/OpenGl_NamedStatus.hxx | 1 - src/OpenGl/OpenGl_View.cxx | 9 ---- src/OpenGl/OpenGl_View.hxx | 7 ---- src/OpenGl/OpenGl_View_Redraw.cxx | 41 ------------------- src/OpenGl/OpenGl_Workspace.cxx | 16 +------- src/OpenGl/OpenGl_Workspace.hxx | 4 -- src/QABugs/QABugs_3.cxx | 24 ----------- src/V3d/V3d_View.cxx | 10 ----- src/V3d/V3d_View.hxx | 12 ------ src/V3d/V3d_View_1.cxx | 18 -------- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 35 ---------------- 16 files changed, 13 insertions(+), 199 deletions(-) diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md index 8e31eb3f8a..899cb1556d 100644 --- a/dox/dev_guides/upgrade/upgrade.md +++ b/dox/dev_guides/upgrade/upgrade.md @@ -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(). diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index 688a3a804f..2a5314b433 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -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: diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp b/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp index 85e697d771..0545bf9807 100755 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp @@ -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 diff --git a/src/Graphic3d/Graphic3d_CView.cxx b/src/Graphic3d/Graphic3d_CView.cxx index f9125a7ef6..a3428f4da5 100644 --- a/src/Graphic3d/Graphic3d_CView.cxx +++ b/src/Graphic3d/Graphic3d_CView.cxx @@ -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()); diff --git a/src/Graphic3d/Graphic3d_CView.hxx b/src/Graphic3d/Graphic3d_CView.hxx index 414004844a..520acacb25 100644 --- a/src/Graphic3d/Graphic3d_CView.hxx +++ b/src/Graphic3d/Graphic3d_CView.hxx @@ -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; diff --git a/src/OpenGl/OpenGl_NamedStatus.hxx b/src/OpenGl/OpenGl_NamedStatus.hxx index 65af7bb7eb..120c80c1ab 100644 --- a/src/OpenGl/OpenGl_NamedStatus.hxx +++ b/src/OpenGl/OpenGl_NamedStatus.hxx @@ -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) diff --git a/src/OpenGl/OpenGl_View.cxx b/src/OpenGl/OpenGl_View.cxx index 39037a70fb..9d5600892b 100644 --- a/src/OpenGl/OpenGl_View.cxx +++ b/src/OpenGl/OpenGl_View.cxx @@ -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; diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx index 2d51c1f19a..a46a6db766 100644 --- a/src/OpenGl/OpenGl_View.hxx +++ b/src/OpenGl/OpenGl_View.hxx @@ -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; diff --git a/src/OpenGl/OpenGl_View_Redraw.cxx b/src/OpenGl/OpenGl_View_Redraw.cxx index e6be3c81a9..78af8c705f 100644 --- a/src/OpenGl/OpenGl_View_Redraw.cxx +++ b/src/OpenGl/OpenGl_View_Redraw.cxx @@ -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 || diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index 94c661c7da..0a4e3f5050 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -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 : diff --git a/src/OpenGl/OpenGl_Workspace.hxx b/src/OpenGl/OpenGl_Workspace.hxx index 519ec7d22a..7e40713802 100644 --- a/src/OpenGl/OpenGl_Workspace.hxx +++ b/src/OpenGl/OpenGl_Workspace.hxx @@ -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; diff --git a/src/QABugs/QABugs_3.cxx b/src/QABugs/QABugs_3.cxx index f6f64540b9..8af72b24be 100644 --- a/src/QABugs/QABugs_3.cxx +++ b/src/QABugs/QABugs_3.cxx @@ -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); diff --git a/src/V3d/V3d_View.cxx b/src/V3d/V3d_View.cxx index 9f7bed1730..20012ad873 100644 --- a/src/V3d/V3d_View.cxx +++ b/src/V3d/V3d_View.cxx @@ -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 (myView->VisualizationType()); } -//============================================================================= -//function : Antialiasing -//purpose : -//============================================================================= -Standard_Boolean V3d_View::Antialiasing() const -{ - return myView->IsAntialiasingEnabled(); -} - //============================================================================= //function : Viewer //purpose : diff --git a/src/V3d/V3d_View.hxx b/src/V3d/V3d_View.hxx index a0a782744e..52bc122767 100644 --- a/src/V3d/V3d_View.hxx +++ b/src/V3d/V3d_View.hxx @@ -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 of plane. //! : Thickness around the plane. diff --git a/src/V3d/V3d_View_1.cxx b/src/V3d/V3d_View_1.cxx index 21e2a48111..bbe9887459 100644 --- a/src/V3d/V3d_View_1.cxx +++ b/src/V3d/V3d_View_1.cxx @@ -39,24 +39,6 @@ #include #include -// ======================================================================= -// 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 : diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 6d423e0932..cb902fd9e3 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -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", -- 2.20.1