OpenGl_View::FBO() - use copy Handle constructor for compatibility.
{
return;
}
- else if (myFBO != NULL)
+ else if (!myFBO.IsNull())
{
OpenGl_View::Redraw();
return;
Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
myToFlipOutput = Standard_True;
myD3dWglFbo->LockSurface (aCtx);
- myFBO = myD3dWglFbo.get();
+ myFBO = myD3dWglFbo;
OpenGl_View::Redraw();
- myFBO = NULL;
+ myFBO.Nullify();
myD3dWglFbo->UnlockSurface (aCtx);
myToFlipOutput = Standard_False;
if (aCtx->caps->buffersNoSwap)
{
return;
}
- else if (myFBO != NULL)
+ else if (!myFBO.IsNull())
{
OpenGl_View::Redraw();
return;
myToFlipOutput = Standard_True;
myD3dWglFbo->LockSurface (aCtx);
- myFBO = myD3dWglFbo.get();
+ myFBO = myD3dWglFbo;
OpenGl_View::RedrawImmediate();
- myFBO = NULL;
+ myFBO.Nullify();
myD3dWglFbo->UnlockSurface (aCtx);
myToFlipOutput = Standard_False;
if (aCtx->caps->buffersNoSwap)
Graphic3d_NListOfHAsciiString.hxx
Graphic3d_NMapOfTransient.hxx
Graphic3d_PriorityDefinitionError.hxx
-Graphic3d_PtrFrameBuffer.hxx
Graphic3d_RenderingMode.hxx
Graphic3d_RenderingParams.hxx
Graphic3d_SequenceOfGroup.hxx
#include <Graphic3d_GraduatedTrihedron.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_NMapOfTransient.hxx>
-#include <Graphic3d_PtrFrameBuffer.hxx>
#include <Graphic3d_RenderingParams.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_SequenceOfStructure.hxx>
const Graphic3d_ZLayerSettings& theSettings) = 0;
//! Returns pointer to an assigned framebuffer object.
- virtual Graphic3d_PtrFrameBuffer FBO() const = 0;
+ virtual Handle(Standard_Transient) FBO() const = 0;
//! Sets framebuffer object for offscreen rendering.
- virtual void SetFBO (const Graphic3d_PtrFrameBuffer theFBO) = 0;
+ virtual void SetFBO (const Handle(Standard_Transient)& theFbo) = 0;
//! Generate offscreen FBO in the graphic library.
//! If not supported on hardware returns NULL.
- virtual Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth,
- const Standard_Integer theHeight) = 0;
+ virtual Handle(Standard_Transient) FBOCreate (const Standard_Integer theWidth,
+ const Standard_Integer theHeight) = 0;
//! Remove offscreen FBO from the graphic library
- virtual void FBORelease (Graphic3d_PtrFrameBuffer& theFBOPtr) = 0;
+ virtual void FBORelease (Handle(Standard_Transient)& theFbo) = 0;
//! Read offscreen FBO configuration.
- virtual void FBOGetDimensions (const Graphic3d_PtrFrameBuffer theFBOPtr,
+ virtual void FBOGetDimensions (const Handle(Standard_Transient)& theFbo,
Standard_Integer& theWidth,
Standard_Integer& theHeight,
Standard_Integer& theWidthMax,
Standard_Integer& theHeightMax) = 0;
//! Change offscreen FBO viewport.
- virtual void FBOChangeViewport (Graphic3d_PtrFrameBuffer& theFBOPtr,
+ virtual void FBOChangeViewport (const Handle(Standard_Transient)& theFbo,
const Standard_Integer theWidth,
const Standard_Integer theHeight) = 0;
#include <Graphic3d_Vec3.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_Address.hxx>
-#include <Graphic3d_PtrFrameBuffer.hxx>
#include <Image_PixMap.hxx>
#include <Graphic3d_BufferType.hxx>
#include <Aspect_Handle.hxx>
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Graphic3d_PtrFrameBuffer_HeaderFile
-#define _Graphic3d_PtrFrameBuffer_HeaderFile
-
-class Graphic3d_FrameBuffer;
-typedef Graphic3d_FrameBuffer* Graphic3d_PtrFrameBuffer;
-
-#endif /*Graphic3d_PtrFrameBuffer_HeaderFile*/
#include <Graphic3d_TypeOfComposition.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_SortType.hxx>
-#include <Graphic3d_PtrFrameBuffer.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Array2OfVertex.hxx>
#include <Graphic3d_BufferType.hxx>
myFog (myDefaultFog),
myZClip (myDefaultZClip),
myCamera (new Graphic3d_Camera()),
- myFBO (NULL),
myUseGLLight (Standard_True),
myToShowTrihedron (false),
myToShowGradTrihedron (false),
//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);
}
const Graphic3d_ZLayerSettings& theSettings) Standard_OVERRIDE;
//! Returns pointer to an assigned framebuffer object.
- Standard_EXPORT virtual Graphic3d_PtrFrameBuffer FBO() const Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(Standard_Transient) FBO() const Standard_OVERRIDE;
//! Sets framebuffer object for offscreen rendering.
- Standard_EXPORT virtual void SetFBO (const Graphic3d_PtrFrameBuffer theFBO) Standard_OVERRIDE;
+ Standard_EXPORT virtual void SetFBO (const Handle(Standard_Transient)& theFbo) Standard_OVERRIDE;
//! Generate offscreen FBO in the graphic library.
//! If not supported on hardware returns NULL.
- Standard_EXPORT virtual Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth,
- const Standard_Integer theHeight) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(Standard_Transient) FBOCreate (const Standard_Integer theWidth,
+ const Standard_Integer theHeight) Standard_OVERRIDE;
//! Remove offscreen FBO from the graphic library
- Standard_EXPORT virtual void FBORelease (Graphic3d_PtrFrameBuffer& theFBOPtr) Standard_OVERRIDE;
+ Standard_EXPORT virtual void FBORelease (Handle(Standard_Transient)& theFbo) Standard_OVERRIDE;
//! Read offscreen FBO configuration.
- Standard_EXPORT virtual void FBOGetDimensions (const Graphic3d_PtrFrameBuffer theFBOPtr,
+ Standard_EXPORT virtual void FBOGetDimensions (const Handle(Standard_Transient)& theFbo,
Standard_Integer& theWidth,
Standard_Integer& theHeight,
Standard_Integer& theWidthMax,
Standard_Integer& theHeightMax) Standard_OVERRIDE;
//! Change offscreen FBO viewport.
- Standard_EXPORT virtual void FBOChangeViewport (Graphic3d_PtrFrameBuffer& theFBOPtr,
+ Standard_EXPORT virtual void FBOChangeViewport (const Handle(Standard_Transient)& theFbo,
const Standard_Integer theWidth,
const Standard_Integer theHeight) Standard_OVERRIDE;
OPENGL_ZCLIP myZClip;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
Handle(Graphic3d_Camera) myCamera;
- OpenGl_FrameBuffer* myFBO;
+ Handle(OpenGl_FrameBuffer) myFBO;
Standard_Boolean myUseGLLight;
Standard_Boolean myToShowTrihedron;
Standard_Boolean myToShowGradTrihedron;
// Frame buffer initialization
OpenGl_FrameBuffer* aFrameBuffer = NULL;
- OpenGl_FrameBuffer* aPrevBuffer = (OpenGl_FrameBuffer*)myFBO;
+ OpenGl_FrameBuffer* aPrevBuffer = myFBO.operator->();
Standard_Integer aFrameWidth (0), aFrameHeight (0),
aPrevBufferX (0), aPrevBufferY (0);
// set resolution ratio
aCtx->SetResolutionRatio (RenderingParams().ResolutionRatio());
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )myFBO;
+ OpenGl_FrameBuffer* aFrameBuffer = myFBO.operator->();
bool toSwap = aCtx->IsRender()
&& !aCtx->caps->buffersNoSwap
&& aFrameBuffer == NULL;
const Graphic3d_StereoMode aStereoMode = myRenderParams.StereoMode;
Graphic3d_Camera::Projection aProjectType = myCamera->ProjectionType();
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )myFBO;
+ OpenGl_FrameBuffer* aFrameBuffer = myFBO.operator->();
if ( aFrameBuffer == NULL
&& !aCtx->DefaultFrameBuffer().IsNull()
// function : FBOCreate
// purpose :
// =======================================================================
-Graphic3d_PtrFrameBuffer OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth,
- const Standard_Integer theHeight)
+Handle(OpenGl_FrameBuffer) OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth,
+ const Standard_Integer theHeight)
{
// activate OpenGL context
if (!Activate())
- return NULL;
+ return Handle(OpenGl_FrameBuffer)();
// create the FBO
const Handle(OpenGl_Context)& aCtx = GetGlContext();
- OpenGl_FrameBuffer* aFrameBuffer = new OpenGl_FrameBuffer();
+ Handle(OpenGl_FrameBuffer) aFrameBuffer = new OpenGl_FrameBuffer();
if (!aFrameBuffer->Init (aCtx, theWidth, theHeight, GL_RGBA8, GL_DEPTH24_STENCIL8, 0))
{
aFrameBuffer->Release (aCtx.operator->());
- delete aFrameBuffer;
- return NULL;
+ return Handle(OpenGl_FrameBuffer)();
}
- return (Graphic3d_PtrFrameBuffer )aFrameBuffer;
+ return aFrameBuffer;
}
// =======================================================================
// function : FBORelease
// purpose :
// =======================================================================
-void OpenGl_Workspace::FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr)
+void OpenGl_Workspace::FBORelease (Handle(OpenGl_FrameBuffer)& theFbo)
{
// activate OpenGL context
if (!Activate()
- || theFBOPtr == NULL)
+ || theFbo.IsNull())
{
return;
}
- // release the object
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer*)theFBOPtr;
- if (aFrameBuffer != NULL)
- {
- aFrameBuffer->Release (GetGlContext().operator->());
- }
- delete aFrameBuffer;
+ theFbo->Release (GetGlContext().operator->());
+ theFbo.Nullify();
}
inline bool getDataFormat (const Image_PixMap& theData,
// function : BufferDump
// purpose :
// =======================================================================
-Standard_Boolean OpenGl_Workspace::BufferDump (OpenGl_FrameBuffer* theFBOPtr,
- Image_PixMap& theImage,
- const Graphic3d_BufferType& theBufferType)
+Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)& theFbo,
+ Image_PixMap& theImage,
+ const Graphic3d_BufferType& theBufferType)
{
GLenum aFormat, aType;
if (theImage.IsEmpty()
#endif
// bind FBO if used
- if (theFBOPtr != NULL && theFBOPtr->IsValid())
+ if (!theFbo.IsNull() && theFbo->IsValid())
{
- theFBOPtr->BindBuffer (GetGlContext());
+ theFbo->BindBuffer (GetGlContext());
}
else
{
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
#endif
- if (theFBOPtr != NULL && theFBOPtr->IsValid())
+ if (!theFbo.IsNull() && theFbo->IsValid())
{
- theFBOPtr->UnbindBuffer (GetGlContext());
+ theFbo->UnbindBuffer (GetGlContext());
}
else
{
#ifndef _OpenGl_Workspace_Header
#define _OpenGl_Workspace_Header
-#include <Graphic3d_PtrFrameBuffer.hxx>
#include <Graphic3d_BufferType.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
const Handle(OpenGl_Context)& GetGlContext() { return myGlContext; }
- Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
+ Standard_EXPORT Handle(OpenGl_FrameBuffer) FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
- Standard_EXPORT void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
+ Standard_EXPORT void FBORelease (Handle(OpenGl_FrameBuffer)& theFbo);
- Standard_Boolean BufferDump (OpenGl_FrameBuffer* theFBOPtr,
- Image_PixMap& theImage,
- const Graphic3d_BufferType& theBufferType);
+ Standard_Boolean BufferDump (const Handle(OpenGl_FrameBuffer)& theFbo,
+ Image_PixMap& theImage,
+ const Graphic3d_BufferType& theBufferType);
Standard_EXPORT Standard_Integer Width() const;
const V3d_StereoDumpOptions theStereoOptions)
{
// always prefer hardware accelerated offscreen buffer
- Graphic3d_PtrFrameBuffer aFBOPtr = NULL;
- Graphic3d_PtrFrameBuffer aPrevFBOPtr = myView->FBO();
+ Handle(Standard_Transient) aFBOPtr;
+ Handle(Standard_Transient) aPrevFBOPtr = myView->FBO();
Standard_Integer aFBOVPSizeX (theWidth), aFBOVPSizeY (theHeight), aFBOSizeXMax (0), aFBOSizeYMax (0);
Standard_Integer aPrevFBOVPSizeX (0), aPrevFBOVPSizeY (0), aPrevFBOSizeXMax (0), aPrevFBOSizeYMax (0);
- if (aPrevFBOPtr != NULL)
+ if (!aPrevFBOPtr.IsNull())
{
myView->FBOGetDimensions (aPrevFBOPtr,
aPrevFBOVPSizeX, aPrevFBOVPSizeY,
}
}
- if (aFBOPtr == NULL)
+ if (aFBOPtr.IsNull())
{
// Try to create hardware accelerated buffer
aFBOPtr = myView->FBOCreate (aFBOVPSizeX, aFBOVPSizeY);
- if (aFBOPtr != NULL)
+ if (!aFBOPtr.IsNull())
{
myView->FBOGetDimensions (aFBOPtr,
aFBOVPSizeX, aFBOVPSizeY,
// If hardware accelerated buffer - try to use onscreen buffer
// Results may be bad!
- if (aFBOPtr == NULL)
+ if (aFBOPtr.IsNull())
{
// retrieve window sizes
Standard_Integer aWinWidth, aWinHeight;
{
myView->FBORelease (aFBOPtr);
}
- else if (aPrevFBOPtr != NULL)
+ else if (!aPrevFBOPtr.IsNull())
{
myView->FBOChangeViewport (aPrevFBOPtr, aPrevFBOVPSizeX, aPrevFBOVPSizeY);
}
{
if (isTileSizeProvided)
{
- Handle(Graphic3d_CView) aGraphicView = ViewerTest::CurrentView()->View();
- Graphic3d_PtrFrameBuffer anOldBuffer = aGraphicView->FBO();
- Graphic3d_PtrFrameBuffer aNewBuffer = aGraphicView->FBOCreate (aTileWidth, aTileHeight);
+ Handle(Graphic3d_CView) aGraphicView = ViewerTest::CurrentView()->View();
+ Handle(Standard_Transient) anOldBuffer = aGraphicView->FBO();
+ Handle(Standard_Transient) aNewBuffer = aGraphicView->FBOCreate (aTileWidth, aTileHeight);
aGraphicView->SetFBO (aNewBuffer);
isPrinted = aView->Print (anDC, 1, 1, 0, Aspect_PA_TILE);