#include <OpenGl_Workspace.hxx>
#include <Standard_CLocaleSentry.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,Graphic3d_CView)
+
#ifdef HAVE_GL2PS
#include <gl2ps.h>
#endif
myAntiAliasing (Standard_False),
myCulling (Standard_True),
myShadingModel (Graphic3d_TOSM_FACET),
- mySurfaceDetail (Graphic3d_TOD_ALL),
myBackfacing (Graphic3d_TOBM_AUTOMATIC),
myBgColor (myDefaultBg),
myFog (myDefaultFog),
myZClip (myDefaultZClip),
myCamera (new Graphic3d_Camera()),
- myFBO (NULL),
myUseGLLight (Standard_True),
myToShowTrihedron (false),
myToShowGradTrihedron (false),
myStateCounter (theCounter),
myLastLightSourceState (0, 0),
+ myFboColorFormat (GL_RGBA8),
+ myFboDepthFormat (GL_DEPTH24_STENCIL8),
+ myToFlipOutput (Standard_False),
myFrameCounter (0),
myHasFboBlit (Standard_True),
myTransientDrawToFront (Standard_True),
if (sscanf (anAaEnv, "%d", &v) > 0) myAntiAliasing = v;
}
+ OpenGl_Light aLight;
+ aLight.Type = Graphic3d_TOLS_AMBIENT;
+ aLight.IsHeadlight = Standard_False;
+ aLight.Color.r() = 1.;
+ aLight.Color.g() = 1.;
+ aLight.Color.b() = 1.;
+ myNoShadingLight.Append (aLight);
+
myCurrLightSourceState = myStateCounter->Increment();
myMainSceneFbos[0] = new OpenGl_FrameBuffer();
myMainSceneFbos[1] = new OpenGl_FrameBuffer();
myImmediateSceneFbos[0] = new OpenGl_FrameBuffer();
myImmediateSceneFbos[1] = new OpenGl_FrameBuffer();
+ myOpenGlFBO = new OpenGl_FrameBuffer();
+ myOpenGlFBO2 = new OpenGl_FrameBuffer();
+ myRaytraceFBO1[0] = new OpenGl_FrameBuffer();
+ myRaytraceFBO1[1] = new OpenGl_FrameBuffer();
+ myRaytraceFBO2[0] = new OpenGl_FrameBuffer();
+ myRaytraceFBO2[1] = new OpenGl_FrameBuffer();
}
// =======================================================================
myMainSceneFbos[1] ->Release (theCtx.operator->());
myImmediateSceneFbos[0]->Release (theCtx.operator->());
myImmediateSceneFbos[1]->Release (theCtx.operator->());
+ myOpenGlFBO ->Release (theCtx.operator->());
+ myOpenGlFBO2 ->Release (theCtx.operator->());
myFullScreenQuad .Release (theCtx.operator->());
myFullScreenQuadFlip .Release (theCtx.operator->());
myGraduatedTrihedron.SetMinMax (theMin, theMax);
}
-// =======================================================================
-// function : ReadDepths
-// purpose :
-// =======================================================================
-void OpenGl_View::ReadDepths (const Standard_Integer theX,
- const Standard_Integer theY,
- const Standard_Integer theWidth,
- const Standard_Integer theHeight,
- const Standard_Address theBuffer) const
-{
- if (myWindow.IsNull())
- return;
-
- myWindow->ReadDepths (theX, theY, theWidth, theHeight, (float*)theBuffer);
-}
-
// =======================================================================
// function : BufferDump
// purpose :
//function : FBO
//purpose :
//=======================================================================
-Graphic3d_PtrFrameBuffer OpenGl_View::FBO() const
+Handle(Standard_Transient) OpenGl_View::FBO() const
{
- return reinterpret_cast<Graphic3d_PtrFrameBuffer> (myFBO);
+ return Handle(Standard_Transient)(myFBO);
}
//=======================================================================
//function : SetFBO
//purpose :
//=======================================================================
-void OpenGl_View::SetFBO (const Graphic3d_PtrFrameBuffer theFBO)
+void OpenGl_View::SetFBO (const Handle(Standard_Transient)& theFbo)
{
- myFBO = reinterpret_cast<OpenGl_FrameBuffer*> (theFBO);
+ myFBO = Handle(OpenGl_FrameBuffer)::DownCast (theFbo);
}
//=======================================================================
//function : FBOCreate
//purpose :
//=======================================================================
-Graphic3d_PtrFrameBuffer OpenGl_View::FBOCreate (const Standard_Integer theWidth,
- const Standard_Integer theHeight)
+Handle(Standard_Transient) OpenGl_View::FBOCreate (const Standard_Integer theWidth,
+ const Standard_Integer theHeight)
{
return myWorkspace->FBOCreate (theWidth, theHeight);
}
//function : FBORelease
//purpose :
//=======================================================================
-void OpenGl_View::FBORelease (Graphic3d_PtrFrameBuffer& theFBOPtr)
+void OpenGl_View::FBORelease (Handle(Standard_Transient)& theFbo)
{
- myWorkspace->FBORelease (theFBOPtr);
+ Handle(OpenGl_FrameBuffer) aFrameBuffer = Handle(OpenGl_FrameBuffer)::DownCast (theFbo);
+ if (aFrameBuffer.IsNull())
+ {
+ return;
+ }
+
+ myWorkspace->FBORelease (aFrameBuffer);
+ theFbo.Nullify();
}
//=======================================================================
//function : FBOGetDimensions
//purpose :
//=======================================================================
-void OpenGl_View::FBOGetDimensions (const Graphic3d_PtrFrameBuffer theFBOPtr,
+void OpenGl_View::FBOGetDimensions (const Handle(Standard_Transient)& theFbo,
Standard_Integer& theWidth,
Standard_Integer& theHeight,
Standard_Integer& theWidthMax,
Standard_Integer& theHeightMax)
{
- const OpenGl_FrameBuffer* aFrameBuffer = (const OpenGl_FrameBuffer* )theFBOPtr;
+ const Handle(OpenGl_FrameBuffer) aFrameBuffer = Handle(OpenGl_FrameBuffer)::DownCast (theFbo);
+ if (aFrameBuffer.IsNull())
+ {
+ return;
+ }
+
theWidth = aFrameBuffer->GetVPSizeX(); // current viewport size
theHeight = aFrameBuffer->GetVPSizeY();
theWidthMax = aFrameBuffer->GetSizeX(); // texture size
//function : FBOChangeViewport
//purpose :
//=======================================================================
-void OpenGl_View::FBOChangeViewport (Graphic3d_PtrFrameBuffer& theFBOPtr,
+void OpenGl_View::FBOChangeViewport (const Handle(Standard_Transient)& theFbo,
const Standard_Integer theWidth,
const Standard_Integer theHeight)
{
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theFBOPtr;
+ const Handle(OpenGl_FrameBuffer) aFrameBuffer = Handle(OpenGl_FrameBuffer)::DownCast (theFbo);
+ if (aFrameBuffer.IsNull())
+ {
+ return;
+ }
+
aFrameBuffer->ChangeViewport (theWidth, theHeight);
}