return Standard_False;
}
-Standard_Boolean OpenGl_GraphicDriver::UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az)
+Standard_Boolean OpenGl_GraphicDriver::UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer /*Axm*/, const Standard_Integer Aym, const Standard_Integer /*AXM*/, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
if (!aCView)
const Standard_Integer aHeight = aCView->WS->Height();
/*
- Patched by P.Dolbey: the window pixel height decreased by one
+ Patched by P.Dolbey: the window pixel height decreased by one
in order for yr to remain within valid coordinate range [0; Ym -1]
where Ym means window pixel height.
*/
return aCView->View->ProjectRasterToObject( aWidth, aHeight, AU, (AYM-1)-Aym-AV, Ax, Ay, Az );
}
-Standard_Boolean OpenGl_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az, Standard_ShortReal& Dx, Standard_ShortReal& Dy, Standard_ShortReal& Dz)
+Standard_Boolean OpenGl_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer /*Axm*/, const Standard_Integer Aym, const Standard_Integer /*AXM*/, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az, Standard_ShortReal& Dx, Standard_ShortReal& Dy, Standard_ShortReal& Dz)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
if (!aCView)
aCView->WS->Resize (theCView.DefWindow);
}
-void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height)
+void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer,
+ const Standard_Integer /*x*/,
+ const Standard_Integer /*y*/,
+ const Standard_Integer /*width*/,
+ const Standard_Integer /*height*/)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
if (aCView)
{
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
return (aCView != NULL) && aCView->WS->BufferDump ((OpenGl_FrameBuffer* )theCView.ptrFBO, theImage, theBufferType);
- return Standard_False;
}
Standard_Boolean OpenGl_Workspace::BufferDump (OpenGl_FrameBuffer* theFBOPtr,
return Standard_True;
}
-void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& ACView)
+void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
{
- if (myMapOfView.IsBound (ACView.ViewId))
- myMapOfView.UnBind (ACView.ViewId);
+ Handle(OpenGl_Context) aShareCtx = GetSharedContext();
+ if (myMapOfView.IsBound (theCView.ViewId))
+ myMapOfView.UnBind (theCView.ViewId);
- if (myMapOfWS.IsBound (ACView.WsId))
- myMapOfWS.UnBind (ACView.WsId);
+ if (myMapOfWS.IsBound (theCView.WsId))
+ myMapOfWS.UnBind (theCView.WsId);
- OpenGl_CView *aCView = (OpenGl_CView *)ACView.ptrView;
+ if (myMapOfWS.IsEmpty() && !myMapOfStructure.IsEmpty())
+ {
+ // The last view removed but some objects still present.
+ // Release GL resources now without object destruction.
+ for (NCollection_DataMap<Standard_Integer, OpenGl_Structure*>::Iterator aStructIt (myMapOfStructure);
+ aStructIt.More (); aStructIt.Next())
+ {
+ OpenGl_Structure* aStruct = aStructIt.ChangeValue();
+ aStruct->ReleaseGlResources (aShareCtx);
+ }
+ }
+
+ OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
+ aCView->View->ReleaseGlResources (aShareCtx);
delete aCView;
- ((Graphic3d_CView *)&ACView)->ptrView = NULL;
+ ((Graphic3d_CView *)&theCView)->ptrView = NULL;
}
void OpenGl_GraphicDriver::SetLight (const Graphic3d_CView& ACView)
aCView->View->SetLights(ACView.Context);
}
-void OpenGl_GraphicDriver::SetPlane (const Graphic3d_CView& ACView)
+void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CView& theCView)
{
- const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
if (aCView)
- aCView->View->SetClippingPlanes(ACView.Context);
+ {
+ aCView->View->SetClipPlanes (theCView.Context.ClipPlanes);
+ }
+}
+
+void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CStructure& theCStructure)
+{
+ OpenGl_Structure* aStructure = (OpenGl_Structure *)theCStructure.ptrStructure;
+ if (aStructure)
+ {
+ aStructure->SetClipPlanes (theCStructure.ClipPlanes);
+ }
}
void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView)
astructure->SetTransformation(&(ACStructure.Transformation[0][0]));
}
-void OpenGl_GraphicDriver::DegenerateStructure (const Graphic3d_CStructure& ACStructure)
-{
- OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
- if (astructure)
- astructure->SetDegenerateModel( ACStructure.ContextFillArea.DegenerationMode, ACStructure.ContextFillArea.SkipRatio );
-}
-
void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
if (aWS.IsNull())
{
Handle(OpenGl_Context) aShareCtx = GetSharedContext();
- aWS = new OpenGl_Workspace (openglDisplay, theCView.DefWindow, theCView.GContext, aShareCtx);
+ aWS = new OpenGl_Workspace (openglDisplay, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
openglDisplay->SetWindow (theCView.DefWindow.XWindow, aWS);
}
//=======================================================================
//function : AddZLayer
-//purpose :
+//purpose :
//=======================================================================
void OpenGl_GraphicDriver::AddZLayer (const Graphic3d_CView& theCView,