1 // Created on: 2021-01-15
2 // Copyright (c) 2021 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _OpenGl_DepthPeeling_HeaderFile
16 #define _OpenGl_DepthPeeling_HeaderFile
18 #include <OpenGl_FrameBuffer.hxx>
19 #include <OpenGl_NamedResource.hxx>
21 //! Class provides FBOs for dual depth peeling.
22 class OpenGl_DepthPeeling : public OpenGl_NamedResource
24 DEFINE_STANDARD_RTTIEXT(OpenGl_DepthPeeling, OpenGl_NamedResource)
28 Standard_EXPORT OpenGl_DepthPeeling();
31 Standard_EXPORT virtual ~OpenGl_DepthPeeling();
33 //! Release OpenGL resources
34 Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx) Standard_OVERRIDE;
36 //! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
37 Standard_EXPORT virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE;
39 //! Attach a texture image
40 Standard_EXPORT void AttachDepthTexture (const Handle(OpenGl_Context)& theCtx,
41 const Handle(OpenGl_Texture)& theDepthStencilTexture);
43 //! Detach a texture image
44 Standard_EXPORT void DetachDepthTexture (const Handle(OpenGl_Context)& theCtx);
46 //! Returns additional buffers for ping-pong
47 const Handle(OpenGl_FrameBuffer)* DepthPeelFbosOit() const { return myDepthPeelFbosOit; }
49 //! Returns additional buffers for ping-pong
50 const Handle(OpenGl_FrameBuffer)* FrontBackColorFbosOit() const { return myFrontBackColorFbosOit; }
52 //! Returns additional FBO for depth peeling
53 const Handle(OpenGl_FrameBuffer)& BlendBackFboOit() const { return myBlendBackFboOit; }
57 Handle(OpenGl_FrameBuffer) myDepthPeelFbosOit[2]; //!< depth + front color + back color
58 Handle(OpenGl_FrameBuffer) myFrontBackColorFbosOit[2]; //!< front color + back color
59 Handle(OpenGl_FrameBuffer) myBlendBackFboOit;
63 #endif // _OpenGl_DepthPeeling_HeaderFile