1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0023044: Regression: 3D views are not invalidated by some modifications of OpenGl_Structure

myIsUpdated flag and Invalidate() method removed from OpenGl_Workspace class.
View redrawing is made unconditional.
V3d_View::Update() becomes deprecated and should be replaced with V3d_View::Redraw().
V3d_Viewer::Update() becomes deprecated and equivalent to Redraw()
This commit is contained in:
san 2012-03-30 17:29:19 +04:00
parent 2bd4c032a3
commit 298f9ad709
11 changed files with 6 additions and 34 deletions

View File

@ -82,12 +82,12 @@ NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& OpenGl_GraphicDriver::
} }
//TsmInitUpdateState //TsmInitUpdateState
// Deprecated, need to decide what to do with EraseAnimation() call
void OpenGl_GraphicDriver::InvalidateAllWorkspaces() void OpenGl_GraphicDriver::InvalidateAllWorkspaces()
{ {
for (NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>::Iterator anIt (OpenGl_GraphicDriver::GetMapOfWorkspaces()); for (NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>::Iterator anIt (OpenGl_GraphicDriver::GetMapOfWorkspaces());
anIt.More(); anIt.Next()) anIt.More(); anIt.Next())
{ {
anIt.ChangeValue()->Invalidate();
anIt.ChangeValue()->EraseAnimation(); anIt.ChangeValue()->EraseAnimation();
} }
} }

View File

@ -338,7 +338,7 @@ private:
//! Access the global map of structures. //! Access the global map of structures.
static NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& GetMapOfStructures(); static NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& GetMapOfStructures();
//! Invalidates all workspaces - thus they will be redrawn on next update call. //! Deprecated.
static void InvalidateAllWorkspaces(); static void InvalidateAllWorkspaces();
public: public:

View File

@ -85,7 +85,6 @@ void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCVie
return; return;
aCView->View->DisplayStructure (aStructure, thePriority); aCView->View->DisplayStructure (aStructure, thePriority);
aCView->WS->Invalidate();
} }
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView, void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
@ -97,7 +96,6 @@ void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
return; return;
aCView->View->EraseStructure (aStructure); aCView->View->EraseStructure (aStructure);
aCView->WS->Invalidate();
} }
void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& theCStructure) void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& theCStructure)

View File

@ -48,7 +48,6 @@ void OpenGl_GraphicDriver::Background (const Graphic3d_CView& ACView)
if (aCView) if (aCView)
{ {
aCView->WS->SetBackgroundColor(ACView.DefWindow.Background.r,ACView.DefWindow.Background.g,ACView.DefWindow.Background.b); aCView->WS->SetBackgroundColor(ACView.DefWindow.Background.r,ACView.DefWindow.Background.g,ACView.DefWindow.Background.b);
aCView->WS->Invalidate();
} }
} }
@ -61,7 +60,6 @@ void OpenGl_GraphicDriver::GradientBackground (const Graphic3d_CView& ACView,
if (aCView) if (aCView)
{ {
aCView->View->SetBackgroundGradient(AColor1,AColor2,AType); aCView->View->SetBackgroundGradient(AColor1,AColor2,AType);
aCView->WS->Invalidate();
} }
} }
@ -115,7 +113,6 @@ void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Stand
if (!AWait) if (!AWait)
{ {
aCView->WS->Resize(ACView.DefWindow); aCView->WS->Resize(ACView.DefWindow);
aCView->WS->Invalidate();
} }
} }
} }
@ -485,7 +482,6 @@ void OpenGl_GraphicDriver::ViewMapping (const Graphic3d_CView& ACView, const Sta
if (!AWait) if (!AWait)
{ {
aCView->WS->Resize(ACView.DefWindow); aCView->WS->Resize(ACView.DefWindow);
aCView->WS->Invalidate();
} }
} }
} }
@ -499,7 +495,6 @@ void OpenGl_GraphicDriver::ViewOrientation (const Graphic3d_CView& ACView, const
if (!AWait) if (!AWait)
{ {
aCView->WS->Resize(ACView.DefWindow); aCView->WS->Resize(ACView.DefWindow);
aCView->WS->Invalidate();
} }
} }
} }

View File

@ -66,7 +66,6 @@ void OpenGl_GraphicDriver::TriedronDisplay (
if (aCView) if (aCView)
{ {
aCView->View->TriedronDisplay(APosition, AColor, AScale, AsWireframe); aCView->View->TriedronDisplay(APosition, AColor, AScale, AsWireframe);
aCView->WS->Invalidate();
} }
} }
@ -76,7 +75,6 @@ void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView)
if (aCView) if (aCView)
{ {
aCView->View->TriedronErase(); aCView->View->TriedronErase();
aCView->WS->Invalidate();
} }
} }
@ -93,7 +91,6 @@ void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName,
if (aCView) if (aCView)
{ {
aCView->View->CreateBackgroundTexture( FileName, FillStyle ); aCView->View->CreateBackgroundTexture( FileName, FillStyle );
aCView->WS->Invalidate();
} }
} }
@ -104,7 +101,6 @@ void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView,
if (aCView) if (aCView)
{ {
aCView->View->SetBackgroundTextureStyle( FillStyle ); aCView->View->SetBackgroundTextureStyle( FillStyle );
aCView->WS->Invalidate();
} }
} }
@ -114,7 +110,6 @@ void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,cons
if (aCView) if (aCView)
{ {
aCView->View->SetBackgroundGradientType(FillType); aCView->View->SetBackgroundGradientType(FillType);
aCView->WS->Invalidate();
} }
} }
@ -124,7 +119,6 @@ void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& ACVi
if (aCView) if (aCView)
{ {
aCView->View->GraduatedTrihedronDisplay(cubic); aCView->View->GraduatedTrihedronDisplay(cubic);
aCView->WS->Invalidate();
} }
} }
@ -134,7 +128,6 @@ void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& ACView
if (aCView) if (aCView)
{ {
aCView->View->GraduatedTrihedronErase(); aCView->View->GraduatedTrihedronErase();
aCView->WS->Invalidate();
} }
} }

View File

@ -65,7 +65,6 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
const CALL_DEF_WINDOW& theCWindow, const CALL_DEF_WINDOW& theCWindow,
Aspect_RenderingContext theGContext) Aspect_RenderingContext theGContext)
: OpenGl_Window (theDisplay, theCWindow, theGContext), : OpenGl_Window (theDisplay, theCWindow, theGContext),
myIsUpdated (Standard_False),
myTransientList (0), myTransientList (0),
myIsTransientOpen (Standard_False), myIsTransientOpen (Standard_False),
myRetainMode (Standard_False), myRetainMode (Standard_False),
@ -158,6 +157,5 @@ void OpenGl_Workspace::UseTransparency (const Standard_Boolean theFlag)
{ {
myUseTransparency = theFlag; myUseTransparency = theFlag;
EraseAnimation(); EraseAnimation();
myIsUpdated = Standard_False;
} }
} }

View File

@ -76,12 +76,11 @@ public:
const Aspect_CLayer2d& theCUnderLayer, const Aspect_CLayer2d& theCUnderLayer,
const Aspect_CLayer2d& theCOverLayer); const Aspect_CLayer2d& theCOverLayer);
//! Redraw window only if needed. //! Deprecated. Simply calls Redraw().
void Update (const Graphic3d_CView& theCView, void Update (const Graphic3d_CView& theCView,
const Aspect_CLayer2d& theCUnderLayer, const Aspect_CLayer2d& theCUnderLayer,
const Aspect_CLayer2d& theCOverLayer) const Aspect_CLayer2d& theCOverLayer)
{ {
if (!myIsUpdated)
Redraw (theCView, theCUnderLayer, theCOverLayer); Redraw (theCView, theCUnderLayer, theCOverLayer);
} }
@ -129,9 +128,6 @@ public:
void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr); void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
Standard_Boolean BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer); Standard_Boolean BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer);
//! Mark this window to be redrawn on next update.
void Invalidate() { myIsUpdated = Standard_False; }
void UseTransparency (const Standard_Boolean theFlag); void UseTransparency (const Standard_Boolean theFlag);
Standard_Boolean& UseZBuffer() { return myUseZBuffer; } Standard_Boolean& UseZBuffer() { return myUseZBuffer; }
Standard_Boolean& UseDepthTest() { return myUseDepthTest; } Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
@ -205,7 +201,6 @@ protected:
protected: protected:
Handle(OpenGl_View) myView; // WSViews - now just one view is supported Handle(OpenGl_View) myView; // WSViews - now just one view is supported
Standard_Boolean myIsUpdated; // WSUpdateState
Tint myTransientList; // WSTransient Tint myTransientList; // WSTransient
Standard_Boolean myIsTransientOpen; // transientOpen Standard_Boolean myIsTransientOpen; // transientOpen
Tint myRetainMode; // WSRetainMode Tint myRetainMode; // WSRetainMode

View File

@ -43,7 +43,6 @@ void OpenGl_Workspace::EndAnimation ()
if( (NamedStatus & OPENGL_NS_ANIMATION) == 0 ) return; if( (NamedStatus & OPENGL_NS_ANIMATION) == 0 ) return;
NamedStatus &= ~(OPENGL_NS_ANIMATION | OPENGL_NS_DEGENERATION | OPENGL_NS_UPDATEAM); NamedStatus &= ~(OPENGL_NS_ANIMATION | OPENGL_NS_DEGENERATION | OPENGL_NS_UPDATEAM);
myIsUpdated = Standard_False;
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/

View File

@ -849,8 +849,6 @@ void OpenGl_Workspace::Redraw1 (const Graphic3d_CView& ACView,
} }
else else
glFlush(); glFlush();
myIsUpdated = Standard_True;
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/

View File

@ -213,9 +213,7 @@ is
Update ( me ) is redefined static; Update ( me ) is redefined static;
---Level: Public ---Level: Public
---Purpose: Updates the display of the view. ---Purpose: Deprecated, Redraw() should be used instead.
-- Must be called to update the view
-- when the update mode is deferred (WAIT) .
Redraw ( me ); Redraw ( me );
---Level: Public ---Level: Public

View File

@ -154,9 +154,7 @@ is
Update (me:mutable ) is redefined static; Update (me:mutable ) is redefined static;
---Level: Public ---Level: Public
---Purpose: Updates the display of all the views of a viewer. ---Purpose: Deprecated, Redraw() should be used instead.
-- Must be called when the views must be updated
-- simultaneously while the Update mode is deferred (WAIT).
UpdateLights (me: mutable); UpdateLights (me: mutable);
---Level: Public ---Level: Public