Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
OpenGl_FrameBuffer Class Reference

Short declaration of useful collection types. More...

#include <OpenGl_FrameBuffer.hxx>

Inheritance diagram for OpenGl_FrameBuffer:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_FrameBuffer (const TCollection_AsciiString &theResourceId=TCollection_AsciiString::EmptyString())
 Empty constructor.
 
 ~OpenGl_FrameBuffer () override
 Destructor.
 
void Release (OpenGl_Context *theGlCtx) override
 Destroy object - will release GPU memory if any.
 
int NbSamples () const
 Number of multisampling samples.
 
int NbColorBuffers () const
 Number of color buffers.
 
bool HasColor () const
 Return true if FBO has been created with color attachment.
 
bool HasDepth () const
 Return true if FBO has been created with depth attachment.
 
NCollection_Vec2< intGetSize () const
 Return textures width x height.
 
int GetSizeX () const
 Textures width.
 
int GetSizeY () const
 Textures height.
 
NCollection_Vec2< intGetVPSize () const
 Return viewport width x height.
 
int GetVPSizeX () const
 Viewport width.
 
int GetVPSizeY () const
 Viewport height.
 
NCollection_Vec2< intGetInitVPSize () const
 Return viewport width x height.
 
int GetInitVPSizeX () const
 Viewport width.
 
int GetInitVPSizeY () const
 Viewport height.
 
bool IsValid () const
 Returns true if current object was initialized.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theSize, const NCollection_DynamicArray< int > &theColorFormats, const occ::handle< OpenGl_Texture > &theDepthStencilTexture, const int theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theSize, const int theColorFormat, const int theDepthFormat, const int theNbSamples=0)
 Initialize FBO for rendering into textures.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theSize, const NCollection_DynamicArray< int > &theColorFormats, const int theDepthFormat, const int theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool InitLazy (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theViewportSize, const int theColorFormat, const int theDepthFormat, const int theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
bool InitLazy (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theViewportSize, const NCollection_DynamicArray< int > &theColorFormats, const int theDepthFormat, const int theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
bool InitLazy (const occ::handle< OpenGl_Context > &theGlCtx, const OpenGl_FrameBuffer &theFbo, const bool theToKeepMsaa=true)
 (Re-)initialize FBO with properties taken from another FBO.
 
bool InitRenderBuffer (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theSize, const NCollection_DynamicArray< int > &theColorFormats, const int theDepthFormat, const int theNbSamples=0)
 (Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).
 
bool InitWithRB (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theSize, const int theColorFormat, const int theDepthFormat, const unsigned int theColorRBufferFromWindow)
 (Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).
 
bool InitWrapper (const occ::handle< OpenGl_Context > &theGlCtx)
 Initialize class from currently bound FBO. Retrieved OpenGL objects will not be destroyed on Release.
 
bool InitWrapper (const occ::handle< OpenGl_Context > &theGlContext, const NCollection_Sequence< occ::handle< OpenGl_Texture > > &theColorTextures, const occ::handle< OpenGl_Texture > &theDepthTexture=occ::handle< OpenGl_Texture >())
 Wrap existing color textures.
 
void SetupViewport (const occ::handle< OpenGl_Context > &theGlCtx)
 Setup viewport to render into FBO.
 
void ChangeViewport (const int theVPSizeX, const int theVPSizeY)
 Override viewport settings.
 
virtual void BindBuffer (const occ::handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for drawing and reading (to render into the texture).
 
virtual void BindDrawBuffer (const occ::handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for drawing GL_DRAW_FRAMEBUFFER (to render into the texture).
 
virtual void BindReadBuffer (const occ::handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for reading GL_READ_FRAMEBUFFER.
 
virtual void UnbindBuffer (const occ::handle< OpenGl_Context > &theGlCtx)
 Unbind frame buffer.
 
const occ::handle< OpenGl_Texture > & ColorTexture (const int theColorBufferIndex=0) const
 Returns the color texture for the given color buffer index.
 
const occ::handle< OpenGl_Texture > & DepthStencilTexture () const
 Returns the depth-stencil texture.
 
bool IsColorRenderBuffer () const
 Returns TRUE if color Render Buffer is defined.
 
unsigned int ColorRenderBuffer () const
 Returns the color Render Buffer.
 
bool IsDepthStencilRenderBuffer () const
 Returns TRUE if depth Render Buffer is defined.
 
unsigned int DepthStencilRenderBuffer () const
 Returns the depth Render Buffer.
 
size_t EstimatedDataSize () const override
 Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
 
bool initRenderBuffer (const occ::handle< OpenGl_Context > &theGlCtx, const NCollection_Vec2< int > &theSize, const NCollection_DynamicArray< int > &theColorFormats, const int theDepthFormat, const int theNbSamples, const unsigned int theColorRBufferFromWindow)
 (Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const int theSizeX, const int theSizeY, const NCollection_DynamicArray< int > &theColorFormats, const occ::handle< OpenGl_Texture > &theDepthStencilTexture, const int theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const int theSizeX, const int theSizeY, const int theColorFormat, const int theDepthFormat, const int theNbSamples=0)
 Initialize FBO for rendering into textures.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const int theSizeX, const int theSizeY, const NCollection_DynamicArray< int > &theColorFormats, const int theDepthFormat, const int theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool InitLazy (const occ::handle< OpenGl_Context > &theGlCtx, const int theViewportSizeX, const int theViewportSizeY, const int theColorFormat, const int theDepthFormat, const int theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
bool InitLazy (const occ::handle< OpenGl_Context > &theGlCtx, const int theViewportSizeX, const int theViewportSizeY, const NCollection_DynamicArray< int > &theColorFormats, const int theDepthFormat, const int theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
bool InitWithRB (const occ::handle< OpenGl_Context > &theGlCtx, const int theSizeX, const int theSizeY, const int theColorFormat, const int theDepthFormat, const unsigned int theColorRBufferFromWindow=0)
 (Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).
 
- Public Member Functions inherited from OpenGl_NamedResource
 OpenGl_NamedResource (const TCollection_AsciiString &theId)
 Empty constructor.
 
const TCollection_AsciiStringResourceId () const
 Return resource name.
 
- Public Member Functions inherited from OpenGl_Resource
 OpenGl_Resource ()
 Empty constructor.
 
 ~OpenGl_Resource () override
 Destructor. Inheritors should call Clean (NULL) within it.
 
virtual void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Static Public Member Functions

static bool BufferDump (const occ::handle< OpenGl_Context > &theGlCtx, const occ::handle< OpenGl_FrameBuffer > &theFbo, Image_PixMap &theImage, Graphic3d_BufferType theBufferType)
 Dump content into image.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Static Public Attributes

static const unsigned int NO_FRAMEBUFFER = 0
 Helpful constants.
 
static const unsigned int NO_RENDERBUFFER = 0
 

Protected Types

typedef NCollection_DynamicArray< occ::handle< OpenGl_Texture > > OpenGl_TextureArray
 

Protected Member Functions

bool isValidFrameBuffer () const
 

Protected Attributes

int myInitVPSizeX
 viewport width specified during initialization (kept even on failure)
 
int myInitVPSizeY
 viewport height specified during initialization (kept even on failure)
 
int myVPSizeX
 viewport width (should be <= texture width)
 
int myVPSizeY
 viewport height (should be <= texture height)
 
int myNbSamples
 number of MSAA samples
 
NCollection_DynamicArray< intmyColorFormats
 sized format for color texture, GL_RGBA8 by default
 
int myDepthFormat
 sized format for depth-stencil texture, GL_DEPTH24_STENCIL8 by default
 
unsigned int myGlFBufferId
 FBO object ID.
 
unsigned int myGlColorRBufferId
 color Render Buffer object (alternative to myColorTexture)
 
unsigned int myGlDepthRBufferId
 depth-stencil Render Buffer object (alternative to myDepthStencilTexture)
 
bool myIsOwnBuffer
 flag indicating that FBO should be deallocated by this class
 
bool myIsOwnColor
 flag indicating that color textures should be deallocated by this class
 
bool myIsOwnDepth
 flag indicating that depth texture should be deallocated by this class
 
OpenGl_TextureArray myColorTextures
 color texture objects
 
occ::handle< OpenGl_TexturemyDepthStencilTexture
 depth-stencil texture object
 
- Protected Attributes inherited from OpenGl_NamedResource
TCollection_AsciiString myResourceId
 resource name
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 

Detailed Description

Short declaration of useful collection types.

Class implements FrameBuffer Object (FBO) resource intended for off-screen rendering.

Member Typedef Documentation

◆ OpenGl_TextureArray

Constructor & Destructor Documentation

◆ OpenGl_FrameBuffer()

OpenGl_FrameBuffer::OpenGl_FrameBuffer ( const TCollection_AsciiString & theResourceId = TCollection_AsciiString::EmptyString())

Empty constructor.

◆ ~OpenGl_FrameBuffer()

OpenGl_FrameBuffer::~OpenGl_FrameBuffer ( )
override

Destructor.

Member Function Documentation

◆ BindBuffer()

virtual void OpenGl_FrameBuffer::BindBuffer ( const occ::handle< OpenGl_Context > & theGlCtx)
virtual

Bind frame buffer for drawing and reading (to render into the texture).

Reimplemented in D3DHost_FrameBuffer.

◆ BindDrawBuffer()

virtual void OpenGl_FrameBuffer::BindDrawBuffer ( const occ::handle< OpenGl_Context > & theGlCtx)
virtual

Bind frame buffer for drawing GL_DRAW_FRAMEBUFFER (to render into the texture).

◆ BindReadBuffer()

virtual void OpenGl_FrameBuffer::BindReadBuffer ( const occ::handle< OpenGl_Context > & theGlCtx)
virtual

Bind frame buffer for reading GL_READ_FRAMEBUFFER.

◆ BufferDump()

static bool OpenGl_FrameBuffer::BufferDump ( const occ::handle< OpenGl_Context > & theGlCtx,
const occ::handle< OpenGl_FrameBuffer > & theFbo,
Image_PixMap & theImage,
Graphic3d_BufferType theBufferType )
static

Dump content into image.

Parameters
theGlCtxbound OpenGL context
theFboFBO to dump (or window buffer, if NULL)
theImagetarget image
theBufferTypebuffer type (attachment) to dump
Returns
TRUE on success

◆ ChangeViewport()

void OpenGl_FrameBuffer::ChangeViewport ( const int theVPSizeX,
const int theVPSizeY )

Override viewport settings.

◆ ColorRenderBuffer()

unsigned int OpenGl_FrameBuffer::ColorRenderBuffer ( ) const
inline

Returns the color Render Buffer.

◆ ColorTexture()

const occ::handle< OpenGl_Texture > & OpenGl_FrameBuffer::ColorTexture ( const int theColorBufferIndex = 0) const
inline

Returns the color texture for the given color buffer index.

◆ DepthStencilRenderBuffer()

unsigned int OpenGl_FrameBuffer::DepthStencilRenderBuffer ( ) const
inline

Returns the depth Render Buffer.

◆ DepthStencilTexture()

const occ::handle< OpenGl_Texture > & OpenGl_FrameBuffer::DepthStencilTexture ( ) const
inline

Returns the depth-stencil texture.

◆ EstimatedDataSize()

size_t OpenGl_FrameBuffer::EstimatedDataSize ( ) const
overridevirtual

Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.

Implements OpenGl_Resource.

◆ GetInitVPSize()

NCollection_Vec2< int > OpenGl_FrameBuffer::GetInitVPSize ( ) const
inline

Return viewport width x height.

◆ GetInitVPSizeX()

int OpenGl_FrameBuffer::GetInitVPSizeX ( ) const
inline

Viewport width.

◆ GetInitVPSizeY()

int OpenGl_FrameBuffer::GetInitVPSizeY ( ) const
inline

Viewport height.

◆ GetSize()

NCollection_Vec2< int > OpenGl_FrameBuffer::GetSize ( ) const
inline

Return textures width x height.

◆ GetSizeX()

int OpenGl_FrameBuffer::GetSizeX ( ) const

Textures width.

◆ GetSizeY()

int OpenGl_FrameBuffer::GetSizeY ( ) const

Textures height.

◆ GetVPSize()

NCollection_Vec2< int > OpenGl_FrameBuffer::GetVPSize ( ) const
inline

Return viewport width x height.

◆ GetVPSizeX()

int OpenGl_FrameBuffer::GetVPSizeX ( ) const
inline

Viewport width.

◆ GetVPSizeY()

int OpenGl_FrameBuffer::GetVPSizeY ( ) const
inline

Viewport height.

◆ HasColor()

bool OpenGl_FrameBuffer::HasColor ( ) const
inline

Return true if FBO has been created with color attachment.

◆ HasDepth()

bool OpenGl_FrameBuffer::HasDepth ( ) const
inline

Return true if FBO has been created with depth attachment.

◆ Init() [1/6]

bool OpenGl_FrameBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const int theSizeX,
const int theSizeY,
const int theColorFormat,
const int theDepthFormat,
const int theNbSamples = 0 )
inline

Initialize FBO for rendering into textures.

Deprecated
("Obsolete method, use Init() taking NCollection_Vec2<int>")

◆ Init() [2/6]

bool OpenGl_FrameBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const int theSizeX,
const int theSizeY,
const NCollection_DynamicArray< int > & theColorFormats,
const int theDepthFormat,
const int theNbSamples = 0 )
inline

Initialize FBO for rendering into single/multiple color buffer and depth textures.

Deprecated
("Obsolete method, use Init() taking NCollection_Vec2<int>")

◆ Init() [3/6]

bool OpenGl_FrameBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const int theSizeX,
const int theSizeY,
const NCollection_DynamicArray< int > & theColorFormats,
const occ::handle< OpenGl_Texture > & theDepthStencilTexture,
const int theNbSamples = 0 )
inline

Initialize FBO for rendering into single/multiple color buffer and depth textures.

Deprecated
("Obsolete method, use Init() taking NCollection_Vec2<int>")

◆ Init() [4/6]

bool OpenGl_FrameBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theSize,
const int theColorFormat,
const int theDepthFormat,
const int theNbSamples = 0 )

Initialize FBO for rendering into textures.

Parameters
theGlCtxcurrently bound OpenGL context
theSizetexture width x height
theColorFormatcolor texture sized format (0 means no color attachment), e.g. GL_RGBA8
theDepthFormatdepth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
theNbSamplesMSAA number of samples (0 means normal texture)
Returns
true on success

◆ Init() [5/6]

bool OpenGl_FrameBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theSize,
const NCollection_DynamicArray< int > & theColorFormats,
const int theDepthFormat,
const int theNbSamples = 0 )

Initialize FBO for rendering into single/multiple color buffer and depth textures.

Parameters
theGlCtxcurrently bound OpenGL context
theSizetexture width x height
theColorFormatslist of color texture sized format (0 means no color attachment), e.g. GL_RGBA8
theDepthFormatdepth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
theNbSamplesMSAA number of samples (0 means normal texture)
Returns
true on success

◆ Init() [6/6]

bool OpenGl_FrameBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theSize,
const NCollection_DynamicArray< int > & theColorFormats,
const occ::handle< OpenGl_Texture > & theDepthStencilTexture,
const int theNbSamples = 0 )

Initialize FBO for rendering into single/multiple color buffer and depth textures.

Parameters
theGlCtxcurrently bound OpenGL context
theSizetexture width x height
theColorFormatslist of color texture sized format (0 means no color attachment), e.g. GL_RGBA8
theDepthStencilTexturedepth-stencil texture
theNbSamplesMSAA number of samples (0 means normal texture)
Returns
true on success

◆ InitLazy() [1/5]

bool OpenGl_FrameBuffer::InitLazy ( const occ::handle< OpenGl_Context > & theGlCtx,
const int theViewportSizeX,
const int theViewportSizeY,
const int theColorFormat,
const int theDepthFormat,
const int theNbSamples = 0 )
inline

(Re-)initialize FBO with specified dimensions.

Deprecated
("Obsolete method, use InitLazy() taking NCollection_Vec2<int>")

◆ InitLazy() [2/5]

bool OpenGl_FrameBuffer::InitLazy ( const occ::handle< OpenGl_Context > & theGlCtx,
const int theViewportSizeX,
const int theViewportSizeY,
const NCollection_DynamicArray< int > & theColorFormats,
const int theDepthFormat,
const int theNbSamples = 0 )
inline

(Re-)initialize FBO with specified dimensions.

Deprecated
("Obsolete method, use InitLazy() taking NCollection_Vec2<int>")

◆ InitLazy() [3/5]

bool OpenGl_FrameBuffer::InitLazy ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theViewportSize,
const int theColorFormat,
const int theDepthFormat,
const int theNbSamples = 0 )

(Re-)initialize FBO with specified dimensions.

◆ InitLazy() [4/5]

bool OpenGl_FrameBuffer::InitLazy ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theViewportSize,
const NCollection_DynamicArray< int > & theColorFormats,
const int theDepthFormat,
const int theNbSamples = 0 )

(Re-)initialize FBO with specified dimensions.

◆ InitLazy() [5/5]

bool OpenGl_FrameBuffer::InitLazy ( const occ::handle< OpenGl_Context > & theGlCtx,
const OpenGl_FrameBuffer & theFbo,
const bool theToKeepMsaa = true )
inline

(Re-)initialize FBO with properties taken from another FBO.

◆ initRenderBuffer()

bool OpenGl_FrameBuffer::initRenderBuffer ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theSize,
const NCollection_DynamicArray< int > & theColorFormats,
const int theDepthFormat,
const int theNbSamples,
const unsigned int theColorRBufferFromWindow )

(Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).

Parameters
theGlCtxcurrently bound OpenGL context
theSizerender buffer width x height
theColorFormatslist of color render buffer sized format, e.g. GL_RGBA8
theDepthFormatdepth-stencil render buffer sized format, e.g. GL_DEPTH24_STENCIL8
theNbSamplesMSAA number of samples (0 means normal render buffer)
theColorRBufferFromWindowwhen specified - should be ID of already initialized RB object, which will be released within this class

◆ InitRenderBuffer()

bool OpenGl_FrameBuffer::InitRenderBuffer ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theSize,
const NCollection_DynamicArray< int > & theColorFormats,
const int theDepthFormat,
const int theNbSamples = 0 )
inline

(Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).

Parameters
theGlCtxcurrently bound OpenGL context
theSizerender buffer width x height
theColorFormatslist of color render buffer sized format, e.g. GL_RGBA8; list should define only one element
theDepthFormatdepth-stencil render buffer sized format, e.g. GL_DEPTH24_STENCIL8
theNbSamplesMSAA number of samples (0 means normal render buffer)

◆ InitWithRB() [1/2]

bool OpenGl_FrameBuffer::InitWithRB ( const occ::handle< OpenGl_Context > & theGlCtx,
const int theSizeX,
const int theSizeY,
const int theColorFormat,
const int theDepthFormat,
const unsigned int theColorRBufferFromWindow = 0 )
inline

(Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).

Deprecated
("Obsolete method, use InitWithRB() taking NCollection_Vec2<int>")

◆ InitWithRB() [2/2]

bool OpenGl_FrameBuffer::InitWithRB ( const occ::handle< OpenGl_Context > & theGlCtx,
const NCollection_Vec2< int > & theSize,
const int theColorFormat,
const int theDepthFormat,
const unsigned int theColorRBufferFromWindow )

(Re-)initialize FBO with specified dimensions. The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).

Parameters
theGlCtxcurrently bound OpenGL context
theSizerender buffer width x height
theColorFormatcolor render buffer sized format, e.g. GL_RGBA8
theDepthFormatdepth-stencil render buffer sized format, e.g. GL_DEPTH24_STENCIL8
theColorRBufferFromWindowshould be ID of already initialized RB object, which will be released within this class

◆ InitWrapper() [1/2]

bool OpenGl_FrameBuffer::InitWrapper ( const occ::handle< OpenGl_Context > & theGlContext,
const NCollection_Sequence< occ::handle< OpenGl_Texture > > & theColorTextures,
const occ::handle< OpenGl_Texture > & theDepthTexture = occ::handleOpenGl_Texture >() )

Wrap existing color textures.

◆ InitWrapper() [2/2]

bool OpenGl_FrameBuffer::InitWrapper ( const occ::handle< OpenGl_Context > & theGlCtx)

Initialize class from currently bound FBO. Retrieved OpenGL objects will not be destroyed on Release.

◆ IsColorRenderBuffer()

bool OpenGl_FrameBuffer::IsColorRenderBuffer ( ) const
inline

Returns TRUE if color Render Buffer is defined.

◆ IsDepthStencilRenderBuffer()

bool OpenGl_FrameBuffer::IsDepthStencilRenderBuffer ( ) const
inline

Returns TRUE if depth Render Buffer is defined.

◆ IsValid()

bool OpenGl_FrameBuffer::IsValid ( ) const
inline

Returns true if current object was initialized.

◆ isValidFrameBuffer()

bool OpenGl_FrameBuffer::isValidFrameBuffer ( ) const
inlineprotected

◆ NbColorBuffers()

int OpenGl_FrameBuffer::NbColorBuffers ( ) const
inline

Number of color buffers.

◆ NbSamples()

int OpenGl_FrameBuffer::NbSamples ( ) const
inline

Number of multisampling samples.

◆ Release()

void OpenGl_FrameBuffer::Release ( OpenGl_Context * theGlCtx)
overridevirtual

Destroy object - will release GPU memory if any.

Implements OpenGl_Resource.

◆ SetupViewport()

void OpenGl_FrameBuffer::SetupViewport ( const occ::handle< OpenGl_Context > & theGlCtx)

Setup viewport to render into FBO.

◆ UnbindBuffer()

virtual void OpenGl_FrameBuffer::UnbindBuffer ( const occ::handle< OpenGl_Context > & theGlCtx)
virtual

Unbind frame buffer.

Field Documentation

◆ myColorFormats

NCollection_DynamicArray<int> OpenGl_FrameBuffer::myColorFormats
protected

sized format for color texture, GL_RGBA8 by default

◆ myColorTextures

OpenGl_TextureArray OpenGl_FrameBuffer::myColorTextures
protected

color texture objects

◆ myDepthFormat

int OpenGl_FrameBuffer::myDepthFormat
protected

sized format for depth-stencil texture, GL_DEPTH24_STENCIL8 by default

◆ myDepthStencilTexture

occ::handle<OpenGl_Texture> OpenGl_FrameBuffer::myDepthStencilTexture
protected

depth-stencil texture object

◆ myGlColorRBufferId

unsigned int OpenGl_FrameBuffer::myGlColorRBufferId
protected

color Render Buffer object (alternative to myColorTexture)

◆ myGlDepthRBufferId

unsigned int OpenGl_FrameBuffer::myGlDepthRBufferId
protected

depth-stencil Render Buffer object (alternative to myDepthStencilTexture)

◆ myGlFBufferId

unsigned int OpenGl_FrameBuffer::myGlFBufferId
protected

FBO object ID.

◆ myInitVPSizeX

int OpenGl_FrameBuffer::myInitVPSizeX
protected

viewport width specified during initialization (kept even on failure)

◆ myInitVPSizeY

int OpenGl_FrameBuffer::myInitVPSizeY
protected

viewport height specified during initialization (kept even on failure)

◆ myIsOwnBuffer

bool OpenGl_FrameBuffer::myIsOwnBuffer
protected

flag indicating that FBO should be deallocated by this class

◆ myIsOwnColor

bool OpenGl_FrameBuffer::myIsOwnColor
protected

flag indicating that color textures should be deallocated by this class

◆ myIsOwnDepth

bool OpenGl_FrameBuffer::myIsOwnDepth
protected

flag indicating that depth texture should be deallocated by this class

◆ myNbSamples

int OpenGl_FrameBuffer::myNbSamples
protected

number of MSAA samples

◆ myVPSizeX

int OpenGl_FrameBuffer::myVPSizeX
protected

viewport width (should be <= texture width)

◆ myVPSizeY

int OpenGl_FrameBuffer::myVPSizeY
protected

viewport height (should be <= texture height)

◆ NO_FRAMEBUFFER

const unsigned int OpenGl_FrameBuffer::NO_FRAMEBUFFER = 0
static

Helpful constants.

◆ NO_RENDERBUFFER

const unsigned int OpenGl_FrameBuffer::NO_RENDERBUFFER = 0
static

The documentation for this class was generated from the following file: