mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0028890: Visualization - After closing all views and then display the view again, just the first view has object(s) displayed
DeviceLost flag has been moved from Graphic3d_GraphicDriver to Graphic3d_StructureManager, so that all Viewers sharing the same Driver instance are properly invalidated. Fixed clearing of objects by vclear command in case of multiple Viewers.
This commit is contained in:
parent
336a63f042
commit
851dacdbb9
@ -49,7 +49,7 @@ D3DHost_GraphicDriver::~D3DHost_GraphicDriver()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Handle(Graphic3d_CView) D3DHost_GraphicDriver::CreateView (const Handle(Graphic3d_StructureManager)& theMgr)
|
Handle(Graphic3d_CView) D3DHost_GraphicDriver::CreateView (const Handle(Graphic3d_StructureManager)& theMgr)
|
||||||
{
|
{
|
||||||
Handle(D3DHost_View) aView = new D3DHost_View (theMgr, this, myCaps, myDeviceLostFlag, &myStateCounter);
|
Handle(D3DHost_View) aView = new D3DHost_View (theMgr, this, myCaps, &myStateCounter);
|
||||||
|
|
||||||
myMapOfView.Add (aView);
|
myMapOfView.Add (aView);
|
||||||
|
|
||||||
|
@ -47,9 +47,8 @@ TCollection_AsciiString D3DHost_View::d3dFormatError (const long theErrCode)
|
|||||||
D3DHost_View::D3DHost_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
D3DHost_View::D3DHost_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
||||||
const Handle(D3DHost_GraphicDriver)& theDriver,
|
const Handle(D3DHost_GraphicDriver)& theDriver,
|
||||||
const Handle(OpenGl_Caps)& theCaps,
|
const Handle(OpenGl_Caps)& theCaps,
|
||||||
Standard_Boolean& theDeviceLostFlag,
|
|
||||||
OpenGl_StateCounter* theCounter)
|
OpenGl_StateCounter* theCounter)
|
||||||
: OpenGl_View (theMgr, theDriver, theCaps, theDeviceLostFlag, theCounter),
|
: OpenGl_View (theMgr, theDriver, theCaps, theCounter),
|
||||||
myD3dLib (NULL),
|
myD3dLib (NULL),
|
||||||
myD3dDevice (NULL),
|
myD3dDevice (NULL),
|
||||||
myD3dParams (new D3DPRESENT_PARAMETERS()),
|
myD3dParams (new D3DPRESENT_PARAMETERS()),
|
||||||
|
@ -35,7 +35,6 @@ public:
|
|||||||
Standard_EXPORT D3DHost_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
Standard_EXPORT D3DHost_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
||||||
const Handle(D3DHost_GraphicDriver)& theDriver,
|
const Handle(D3DHost_GraphicDriver)& theDriver,
|
||||||
const Handle(OpenGl_Caps)& theCaps,
|
const Handle(OpenGl_Caps)& theCaps,
|
||||||
Standard_Boolean& theDeviceLostFlag,
|
|
||||||
OpenGl_StateCounter* theCounter);
|
OpenGl_StateCounter* theCounter);
|
||||||
|
|
||||||
//! Default destructor.
|
//! Default destructor.
|
||||||
|
@ -23,8 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_GraphicDriver,Standard_Transient)
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp)
|
Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp)
|
||||||
: myDisplayConnection (theDisp),
|
: myDisplayConnection (theDisp)
|
||||||
myDeviceLostFlag (Standard_False)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -38,24 +37,6 @@ const Handle(Aspect_DisplayConnection)& Graphic3d_GraphicDriver::GetDisplayConne
|
|||||||
return myDisplayConnection;
|
return myDisplayConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : IsDeviceLost
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Boolean Graphic3d_GraphicDriver::IsDeviceLost() const
|
|
||||||
{
|
|
||||||
return myDeviceLostFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : ResetDeviceLostFlag
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void Graphic3d_GraphicDriver::ResetDeviceLostFlag()
|
|
||||||
{
|
|
||||||
myDeviceLostFlag = Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : NewIdentification
|
// function : NewIdentification
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -139,10 +139,6 @@ public:
|
|||||||
//! returns Handle to display connection
|
//! returns Handle to display connection
|
||||||
Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const;
|
Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsDeviceLost() const;
|
|
||||||
|
|
||||||
Standard_EXPORT void ResetDeviceLostFlag();
|
|
||||||
|
|
||||||
//! Returns a new identification number for a new structure.
|
//! Returns a new identification number for a new structure.
|
||||||
Standard_EXPORT Standard_Integer NewIdentification();
|
Standard_EXPORT Standard_Integer NewIdentification();
|
||||||
|
|
||||||
@ -153,27 +149,14 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
//! Initializes the Driver
|
//! Initializes the Driver
|
||||||
Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp);
|
Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
Handle(Aspect_DisplayConnection) myDisplayConnection;
|
Handle(Aspect_DisplayConnection) myDisplayConnection;
|
||||||
Standard_Boolean myDeviceLostFlag;
|
|
||||||
|
|
||||||
Aspect_GenId myStructGenId;
|
Aspect_GenId myStructGenId;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _Graphic3d_GraphicDriver_HeaderFile
|
#endif // _Graphic3d_GraphicDriver_HeaderFile
|
||||||
|
@ -30,7 +30,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_StructureManager,Standard_Transient)
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
|
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
|
||||||
: myViewGenId (0, 31),
|
: myViewGenId (0, 31),
|
||||||
myGraphicDriver (theDriver)
|
myGraphicDriver (theDriver),
|
||||||
|
myDeviceLostFlag (Standard_False)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -149,9 +150,10 @@ const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver
|
|||||||
|
|
||||||
void Graphic3d_StructureManager::RecomputeStructures()
|
void Graphic3d_StructureManager::RecomputeStructures()
|
||||||
{
|
{
|
||||||
|
myDeviceLostFlag = Standard_False;
|
||||||
|
|
||||||
// Go through all unique structures including child (connected) ones and ensure that they are computed.
|
// Go through all unique structures including child (connected) ones and ensure that they are computed.
|
||||||
Graphic3d_MapOfStructure aStructNetwork;
|
Graphic3d_MapOfStructure aStructNetwork;
|
||||||
|
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure anIter(myDisplayedStructure); anIter.More(); anIter.Next())
|
for (Graphic3d_MapIteratorOfMapOfStructure anIter(myDisplayedStructure); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
Handle(Graphic3d_Structure) aStructure = anIter.Key();
|
Handle(Graphic3d_Structure) aStructure = anIter.Key();
|
||||||
|
@ -38,10 +38,6 @@ typedef NCollection_IndexedMap<Graphic3d_CView*> Graphic3d_IndexedMapOfView;
|
|||||||
class Graphic3d_GraphicDriver;
|
class Graphic3d_GraphicDriver;
|
||||||
class Graphic3d_Structure;
|
class Graphic3d_Structure;
|
||||||
class Graphic3d_DataStructureManager;
|
class Graphic3d_DataStructureManager;
|
||||||
class Standard_Transient;
|
|
||||||
|
|
||||||
class Graphic3d_StructureManager;
|
|
||||||
DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, Standard_Transient)
|
|
||||||
|
|
||||||
//! This class allows the definition of a manager to
|
//! This class allows the definition of a manager to
|
||||||
//! which the graphic objects are associated.
|
//! which the graphic objects are associated.
|
||||||
@ -51,6 +47,8 @@ DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, Standard_Transient)
|
|||||||
//! Destroy, Highlight, Visible
|
//! Destroy, Highlight, Visible
|
||||||
class Graphic3d_StructureManager : public Standard_Transient
|
class Graphic3d_StructureManager : public Standard_Transient
|
||||||
{
|
{
|
||||||
|
friend class Graphic3d_Structure;
|
||||||
|
DEFINE_STANDARD_RTTIEXT(Graphic3d_StructureManager, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Initializes the ViewManager.
|
//! Initializes the ViewManager.
|
||||||
@ -144,6 +142,8 @@ public:
|
|||||||
//! Suppresses the highlighting on all the structures in <me>.
|
//! Suppresses the highlighting on all the structures in <me>.
|
||||||
Standard_EXPORT virtual void UnHighlight();
|
Standard_EXPORT virtual void UnHighlight();
|
||||||
|
|
||||||
|
//! Recomputes all structures in the manager.
|
||||||
|
//! Resets Device Lost flag.
|
||||||
Standard_EXPORT void RecomputeStructures();
|
Standard_EXPORT void RecomputeStructures();
|
||||||
|
|
||||||
//! Recomputes all structures from theStructures.
|
//! Recomputes all structures from theStructures.
|
||||||
@ -155,9 +155,11 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Handle(Graphic3d_ViewAffinity) ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
|
Standard_EXPORT Handle(Graphic3d_ViewAffinity) ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
|
||||||
|
|
||||||
friend class Graphic3d_Structure;
|
//! Returns TRUE if Device Lost flag has been set and presentation data should be reuploaded onto graphics driver.
|
||||||
|
Standard_Boolean IsDeviceLost() const { return myDeviceLostFlag; }
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_StructureManager,Standard_Transient)
|
//! Sets Device Lost flag.
|
||||||
|
void SetDeviceLost() { myDeviceLostFlag = Standard_True; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -174,6 +176,9 @@ protected:
|
|||||||
Graphic3d_MapOfObject myRegisteredObjects;
|
Graphic3d_MapOfObject myRegisteredObjects;
|
||||||
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
|
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
|
||||||
Graphic3d_IndexedMapOfView myDefinedViews;
|
Graphic3d_IndexedMapOfView myDefinedViews;
|
||||||
|
Standard_Boolean myDeviceLostFlag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, Standard_Transient)
|
||||||
|
|
||||||
#endif // _Graphic3d_StructureManager_HeaderFile
|
#endif // _Graphic3d_StructureManager_HeaderFile
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <Aspect_GraphicDeviceDefinitionError.hxx>
|
#include <Aspect_GraphicDeviceDefinitionError.hxx>
|
||||||
#include <Aspect_IdentDefinitionError.hxx>
|
#include <Aspect_IdentDefinitionError.hxx>
|
||||||
|
#include <Graphic3d_StructureManager.hxx>
|
||||||
#include <Message_Messenger.hxx>
|
#include <Message_Messenger.hxx>
|
||||||
#include <OSD_Environment.hxx>
|
#include <OSD_Environment.hxx>
|
||||||
#include <Standard_NotImplemented.hxx>
|
#include <Standard_NotImplemented.hxx>
|
||||||
@ -218,12 +219,17 @@ void OpenGl_GraphicDriver::ReleaseContext()
|
|||||||
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
|
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
|
||||||
aStruct->ReleaseGlResources (aCtxShared);
|
aStruct->ReleaseGlResources (aCtxShared);
|
||||||
}
|
}
|
||||||
myDeviceLostFlag = myDeviceLostFlag || !myMapOfStructure.IsEmpty();
|
|
||||||
|
|
||||||
|
const bool isDeviceLost = !myMapOfStructure.IsEmpty();
|
||||||
for (NCollection_Map<Handle(OpenGl_View)>::Iterator aViewIter (myMapOfView);
|
for (NCollection_Map<Handle(OpenGl_View)>::Iterator aViewIter (myMapOfView);
|
||||||
aViewIter.More(); aViewIter.Next())
|
aViewIter.More(); aViewIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(OpenGl_View)& aView = aViewIter.Value();
|
const Handle(OpenGl_View)& aView = aViewIter.Value();
|
||||||
|
if (isDeviceLost)
|
||||||
|
{
|
||||||
|
aView->StructureManager()->SetDeviceLost();
|
||||||
|
}
|
||||||
|
|
||||||
const Handle(OpenGl_Window)& aWindow = aView->GlWindow();
|
const Handle(OpenGl_Window)& aWindow = aView->GlWindow();
|
||||||
if (aWindow.IsNull())
|
if (aWindow.IsNull())
|
||||||
{
|
{
|
||||||
@ -730,7 +736,7 @@ void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCSt
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Handle(Graphic3d_CView) OpenGl_GraphicDriver::CreateView (const Handle(Graphic3d_StructureManager)& theMgr)
|
Handle(Graphic3d_CView) OpenGl_GraphicDriver::CreateView (const Handle(Graphic3d_StructureManager)& theMgr)
|
||||||
{
|
{
|
||||||
Handle(OpenGl_View) aView = new OpenGl_View (theMgr, this, myCaps, myDeviceLostFlag, &myStateCounter);
|
Handle(OpenGl_View) aView = new OpenGl_View (theMgr, this, myCaps, &myStateCounter);
|
||||||
|
|
||||||
myMapOfView.Add (aView);
|
myMapOfView.Add (aView);
|
||||||
|
|
||||||
@ -792,7 +798,11 @@ void OpenGl_GraphicDriver::RemoveView (const Handle(Graphic3d_CView)& theView)
|
|||||||
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
|
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
|
||||||
aStruct->ReleaseGlResources (aCtx);
|
aStruct->ReleaseGlResources (aCtx);
|
||||||
}
|
}
|
||||||
myDeviceLostFlag = !myMapOfStructure.IsEmpty();
|
|
||||||
|
if (!myMapOfStructure.IsEmpty())
|
||||||
|
{
|
||||||
|
aView->StructureManager()->SetDeviceLost();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,3 +882,24 @@ Standard_Boolean OpenGl_GraphicDriver::ViewExists (const Handle(Aspect_Window)&
|
|||||||
|
|
||||||
return isExist;
|
return isExist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : setDeviceLost
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void OpenGl_GraphicDriver::setDeviceLost()
|
||||||
|
{
|
||||||
|
if (myMapOfStructure.IsEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (NCollection_Map<Handle(OpenGl_View)>::Iterator aViewIter (myMapOfView); aViewIter.More(); aViewIter.Next())
|
||||||
|
{
|
||||||
|
const Handle(OpenGl_View)& aView = aViewIter.Value();
|
||||||
|
if (aView->myWasRedrawnGL)
|
||||||
|
{
|
||||||
|
aView->StructureManager()->SetDeviceLost();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -74,13 +74,10 @@ private:
|
|||||||
Standard_Size myCounter;
|
Standard_Size myCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpenGl_GraphicDriver;
|
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
|
|
||||||
|
|
||||||
//! This class defines an OpenGl graphic driver
|
//! This class defines an OpenGl graphic driver
|
||||||
class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver
|
class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_GraphicDriver, Graphic3d_GraphicDriver)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
@ -200,9 +197,8 @@ public:
|
|||||||
//! Insert index layer at proper position.
|
//! Insert index layer at proper position.
|
||||||
Standard_EXPORT void addZLayerIndex (const Graphic3d_ZLayerId theLayerId);
|
Standard_EXPORT void addZLayerIndex (const Graphic3d_ZLayerId theLayerId);
|
||||||
|
|
||||||
public:
|
//! Set device lost flag for redrawn views.
|
||||||
|
Standard_EXPORT void setDeviceLost();
|
||||||
DEFINE_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -234,4 +230,6 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(OpenGl_GraphicDriver, Graphic3d_GraphicDriver)
|
||||||
|
|
||||||
#endif //_OpenGl_GraphicDriver_HeaderFile
|
#endif //_OpenGl_GraphicDriver_HeaderFile
|
||||||
|
@ -49,12 +49,10 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,Graphic3d_CView)
|
|||||||
OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
||||||
const Handle(OpenGl_GraphicDriver)& theDriver,
|
const Handle(OpenGl_GraphicDriver)& theDriver,
|
||||||
const Handle(OpenGl_Caps)& theCaps,
|
const Handle(OpenGl_Caps)& theCaps,
|
||||||
Standard_Boolean& theDeviceLostFlag,
|
|
||||||
OpenGl_StateCounter* theCounter)
|
OpenGl_StateCounter* theCounter)
|
||||||
: Graphic3d_CView (theMgr),
|
: Graphic3d_CView (theMgr),
|
||||||
myDriver (theDriver.operator->()),
|
myDriver (theDriver.operator->()),
|
||||||
myCaps (theCaps),
|
myCaps (theCaps),
|
||||||
myDeviceLostFlag (theDeviceLostFlag),
|
|
||||||
myWasRedrawnGL (Standard_False),
|
myWasRedrawnGL (Standard_False),
|
||||||
myCulling (Standard_True),
|
myCulling (Standard_True),
|
||||||
myShadingModel (Graphic3d_TOSM_FACET),
|
myShadingModel (Graphic3d_TOSM_FACET),
|
||||||
|
@ -74,7 +74,6 @@ public:
|
|||||||
Standard_EXPORT OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
Standard_EXPORT OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
||||||
const Handle(OpenGl_GraphicDriver)& theDriver,
|
const Handle(OpenGl_GraphicDriver)& theDriver,
|
||||||
const Handle(OpenGl_Caps)& theCaps,
|
const Handle(OpenGl_Caps)& theCaps,
|
||||||
Standard_Boolean& theDeviceLostFlag,
|
|
||||||
OpenGl_StateCounter* theCounter);
|
OpenGl_StateCounter* theCounter);
|
||||||
|
|
||||||
//! Default destructor.
|
//! Default destructor.
|
||||||
@ -470,7 +469,6 @@ protected:
|
|||||||
Handle(OpenGl_Window) myWindow;
|
Handle(OpenGl_Window) myWindow;
|
||||||
Handle(OpenGl_Workspace) myWorkspace;
|
Handle(OpenGl_Workspace) myWorkspace;
|
||||||
Handle(OpenGl_Caps) myCaps;
|
Handle(OpenGl_Caps) myCaps;
|
||||||
Standard_Boolean& myDeviceLostFlag;
|
|
||||||
Standard_Boolean myWasRedrawnGL;
|
Standard_Boolean myWasRedrawnGL;
|
||||||
|
|
||||||
Standard_Boolean myCulling;
|
Standard_Boolean myCulling;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <OpenGl_GlCore11.hxx>
|
#include <OpenGl_GlCore11.hxx>
|
||||||
|
|
||||||
#include <Graphic3d_GraphicDriver.hxx>
|
#include <Graphic3d_GraphicDriver.hxx>
|
||||||
|
#include <Graphic3d_StructureManager.hxx>
|
||||||
#include <Graphic3d_TextureParams.hxx>
|
#include <Graphic3d_TextureParams.hxx>
|
||||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||||
#include <Graphic3d_TransformUtils.hxx>
|
#include <Graphic3d_TransformUtils.hxx>
|
||||||
@ -145,11 +146,9 @@ void OpenGl_View::Redraw()
|
|||||||
&& !myCaps->vboDisable
|
&& !myCaps->vboDisable
|
||||||
&& !myCaps->keepArrayData)
|
&& !myCaps->keepArrayData)
|
||||||
{
|
{
|
||||||
if (myWasRedrawnGL)
|
// caps are shared across all views, thus we need to invalidate all of them
|
||||||
{
|
// if (myWasRedrawnGL) { myStructureManager->SetDeviceLost(); }
|
||||||
myDeviceLostFlag = Standard_True;
|
myDriver->setDeviceLost();
|
||||||
}
|
|
||||||
|
|
||||||
myCaps->keepArrayData = Standard_True;
|
myCaps->keepArrayData = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,21 +244,19 @@ void V3d_View::Redraw() const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Graphic3d_GraphicDriver) aGraphicDriver = MyViewer->Driver();
|
|
||||||
Handle(Graphic3d_StructureManager) aStructureMgr = MyViewer->StructureManager();
|
Handle(Graphic3d_StructureManager) aStructureMgr = MyViewer->StructureManager();
|
||||||
for (Standard_Integer aRetryIter = 0; aRetryIter < 2; ++aRetryIter)
|
for (Standard_Integer aRetryIter = 0; aRetryIter < 2; ++aRetryIter)
|
||||||
{
|
{
|
||||||
if (aGraphicDriver->IsDeviceLost())
|
if (aStructureMgr->IsDeviceLost())
|
||||||
{
|
{
|
||||||
aStructureMgr->RecomputeStructures();
|
aStructureMgr->RecomputeStructures();
|
||||||
aGraphicDriver->ResetDeviceLostFlag();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoZFit();
|
AutoZFit();
|
||||||
|
|
||||||
myView->Redraw();
|
myView->Redraw();
|
||||||
|
|
||||||
if (!aGraphicDriver->IsDeviceLost())
|
if (!aStructureMgr->IsDeviceLost())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -638,18 +638,38 @@ Handle(AIS_Shape) GetAISShapeFromName(const char* name)
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
void ViewerTest::Clear()
|
void ViewerTest::Clear()
|
||||||
{
|
{
|
||||||
if ( !a3DView().IsNull() ) {
|
if (a3DView().IsNull())
|
||||||
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
|
{
|
||||||
while ( it.More() ) {
|
return;
|
||||||
cout << "Remove " << it.Key2() << endl;
|
|
||||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (it.Key1());
|
|
||||||
TheAISContext()->Remove(anObj,Standard_False);
|
|
||||||
it.Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NCollection_Sequence<Handle(AIS_InteractiveObject)> aListRemoved;
|
||||||
|
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anObjIter (GetMapOfAIS()); anObjIter.More(); anObjIter.Next())
|
||||||
|
{
|
||||||
|
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anObjIter.Key1());
|
||||||
|
if (anObj->GetContext() != TheAISContext())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Remove " << anObjIter.Key2() << std::endl;
|
||||||
|
TheAISContext()->Remove (anObj, Standard_False);
|
||||||
|
aListRemoved.Append (anObj);
|
||||||
|
}
|
||||||
|
|
||||||
TheAISContext()->RebuildSelectionStructs();
|
TheAISContext()->RebuildSelectionStructs();
|
||||||
TheAISContext()->UpdateCurrentViewer();
|
TheAISContext()->UpdateCurrentViewer();
|
||||||
|
if (aListRemoved.Size() == GetMapOfAIS().Extent())
|
||||||
|
{
|
||||||
GetMapOfAIS().Clear();
|
GetMapOfAIS().Clear();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (NCollection_Sequence<Handle(AIS_InteractiveObject)>::Iterator anObjIter (aListRemoved); anObjIter.More(); anObjIter.Next())
|
||||||
|
{
|
||||||
|
GetMapOfAIS().UnBind1 (anObjIter.Value());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
@ -1120,6 +1120,7 @@ void ViewerTest::RemoveView (const TCollection_AsciiString& theViewName, const S
|
|||||||
|
|
||||||
// Remove view resources
|
// Remove view resources
|
||||||
ViewerTest_myViews.UnBind1(theViewName);
|
ViewerTest_myViews.UnBind1(theViewName);
|
||||||
|
aView->Window()->Unmap();
|
||||||
aView->Remove();
|
aView->Remove();
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||||
|
42
tests/bugs/vis/bug28890
Normal file
42
tests/bugs/vis/bug28890
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "0028890: Visualization - After closing all views and then display the view again, just the first view has object(s) displayed"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload MODELING VISUALIZATION
|
||||||
|
vclear
|
||||||
|
vclose ALL
|
||||||
|
box b1_1 0 0 0 1 2 3
|
||||||
|
box b1_2 0 3 0 3 1 2
|
||||||
|
box b2_1 0 0 0 3 1 2
|
||||||
|
box b2_2 0 3 0 1 2 3
|
||||||
|
|
||||||
|
# fill first Viewer
|
||||||
|
vinit Driver1/Viewer1/View1
|
||||||
|
vzbufftrihedron
|
||||||
|
vdisplay -dispMode 1 b1_1 b1_2
|
||||||
|
vfit
|
||||||
|
vsetcolor b1_1 RED
|
||||||
|
vsetcolor b1_2 GREEN
|
||||||
|
|
||||||
|
# fill second Viewer
|
||||||
|
vinit Driver1/Viewer2/View1
|
||||||
|
vzbufftrihedron
|
||||||
|
vdisplay -dispMode 1 b2_1 b2_2
|
||||||
|
vfit
|
||||||
|
vsetcolor b2_1 RED
|
||||||
|
vsetcolor b2_2 GREEN
|
||||||
|
|
||||||
|
# enable RayTracing which sets DeviceLost flag
|
||||||
|
vactivate Driver1/Viewer1/View1
|
||||||
|
vraytrace 1
|
||||||
|
set aColor1 [vreadpixel 150 250 rgb]
|
||||||
|
vdump $::imagedir/${::casename}_1.png
|
||||||
|
|
||||||
|
vactivate Driver1/Viewer2/View1
|
||||||
|
vraytrace 1
|
||||||
|
set aColor2 [vreadpixel 150 250 rgb]
|
||||||
|
vdump $::imagedir/${::casename}_2.png
|
||||||
|
|
||||||
|
# check that DeviceLost flag is processed by both Viewers
|
||||||
|
if { "$aColor1" != "$aColor2" } { puts "Error: colors should be equal" }
|
Loading…
x
Reference in New Issue
Block a user