Open CASCADE Technology 7.8.0
Public Member Functions | Protected Member Functions | Protected Attributes
D3DHost_FrameBuffer Class Reference

Implements bridge FBO for direct rendering to Direct3D surfaces. More...

#include <D3DHost_FrameBuffer.hxx>

Inheritance diagram for D3DHost_FrameBuffer:
Inheritance graph
[legend]

Public Member Functions

 D3DHost_FrameBuffer ()
 Empty constructor.
 
 ~D3DHost_FrameBuffer ()
 Destructor, should be called after Release().
 
virtual void Release (OpenGl_Context *theCtx) override
 Releases D3D and OpenGL resources.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theCtx, IDirect3DDevice9 *theD3DDevice, const Standard_Boolean theIsD3dEx, const Standard_Integer theSizeX, const Standard_Integer theSizeY)
 Initializes OpenGL FBO for Direct3D interoperability or in fallback mode. Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA; depth-stencil pixel format is GL_DEPTH24_STENCIL8.
 
Standard_Boolean InitD3dInterop (const Handle< OpenGl_Context > &theCtx, IDirect3DDevice9 *theD3DDevice, const Standard_Boolean theIsD3dEx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const Standard_Integer theDepthFormat)
 Initializes OpenGL FBO for Direct3D interoperability. Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.
 
Standard_Boolean InitD3dFallback (const Handle< OpenGl_Context > &theCtx, IDirect3DDevice9 *theD3DDevice, const Standard_Boolean theIsD3dEx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const Standard_Integer theDepthFormat)
 Initializes OpenGL FBO + Direct3D surface for copying memory using fallback. Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.
 
Standard_Boolean registerD3dBuffer (const Handle< OpenGl_Context > &theCtx)
 Binds Direct3D color buffer to OpenGL texture.
 
virtual void BindBuffer (const Handle< OpenGl_Context > &theCtx) override
 Binds Direct3D objects for OpenGL drawing. Should be called before LockSurface() and followed by UnlockSurface();.
 
virtual void LockSurface (const Handle< OpenGl_Context > &theCtx)
 Acquires D3D resource for OpenGL usage.
 
virtual void UnlockSurface (const Handle< OpenGl_Context > &theCtx)
 Releases D3D resource.
 
IDirect3DSurface9D3dColorSurface ()
 Returns D3D surface used as color buffer.
 
void * D3dColorSurfaceShare ()
 Returns WDDM handle for D3D color surface.
 
Standard_Boolean D3dFallback () const
 Returns TRUE if FBO has been initialized without WGL/D3D interop.
 
Standard_Boolean IsSRGBReady () const
 Returns TRUE if color buffer is sRGB ready; FALSE by default. Requires D3DSAMP_SRGBTEXTURE sampler parameter being set on D3D level for rendering D3D surface.
 
void SetSRGBReady (Standard_Boolean theIsReady)
 Set if color buffer is sRGB ready.
 
- Public Member Functions inherited from OpenGl_FrameBuffer
 OpenGl_FrameBuffer (const TCollection_AsciiString &theResourceId=TCollection_AsciiString())
 Empty constructor.
 
virtual ~OpenGl_FrameBuffer ()
 Destructor.
 
Standard_Integer NbSamples () const
 Number of multisampling samples.
 
Standard_Integer 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.
 
Graphic3d_Vec2i GetSize () const
 Return textures width x height.
 
Standard_Integer GetSizeX () const
 Textures width.
 
Standard_Integer GetSizeY () const
 Textures height.
 
Graphic3d_Vec2i GetVPSize () const
 Return viewport width x height.
 
Standard_Integer GetVPSizeX () const
 Viewport width.
 
Standard_Integer GetVPSizeY () const
 Viewport height.
 
Graphic3d_Vec2i GetInitVPSize () const
 Return viewport width x height.
 
Standard_Integer GetInitVPSizeX () const
 Viewport width.
 
Standard_Integer GetInitVPSizeY () const
 Viewport height.
 
Standard_Boolean IsValid () const
 Returns true if current object was initialized.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const OpenGl_ColorFormats &theColorFormats, const Handle< OpenGl_Texture > &theDepthStencilTexture, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const Standard_Integer theColorFormat, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into textures.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
Standard_Boolean InitLazy (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theViewportSize, const Standard_Integer theColorFormat, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
Standard_Boolean InitLazy (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theViewportSize, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
Standard_Boolean InitLazy (const Handle< OpenGl_Context > &theGlCtx, const OpenGl_FrameBuffer &theFbo, const Standard_Boolean theToKeepMsaa=true)
 (Re-)initialize FBO with properties taken from another FBO.
 
Standard_Boolean InitRenderBuffer (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer 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).
 
Standard_Boolean InitWithRB (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const Standard_Integer theColorFormat, const Standard_Integer 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).
 
Standard_Boolean InitWrapper (const Handle< OpenGl_Context > &theGlCtx)
 Initialize class from currently bound FBO. Retrieved OpenGL objects will not be destroyed on Release.
 
Standard_Boolean InitWrapper (const Handle< OpenGl_Context > &theGlContext, const NCollection_Sequence< Handle< OpenGl_Texture > > &theColorTextures, const Handle< OpenGl_Texture > &theDepthTexture=Handle< OpenGl_Texture >())
 Wrap existing color textures.
 
void SetupViewport (const Handle< OpenGl_Context > &theGlCtx)
 Setup viewport to render into FBO.
 
void ChangeViewport (const Standard_Integer theVPSizeX, const Standard_Integer theVPSizeY)
 Override viewport settings.
 
virtual void BindDrawBuffer (const Handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for drawing GL_DRAW_FRAMEBUFFER (to render into the texture).
 
virtual void BindReadBuffer (const Handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for reading GL_READ_FRAMEBUFFER.
 
virtual void UnbindBuffer (const Handle< OpenGl_Context > &theGlCtx)
 Unbind frame buffer.
 
const Handle< OpenGl_Texture > & ColorTexture (const Standard_Integer theColorBufferIndex=0) const
 Returns the color texture for the given color buffer index.
 
const 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.
 
virtual Standard_Size EstimatedDataSize () const override
 Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
 
Standard_Boolean initRenderBuffer (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer 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 Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const OpenGl_ColorFormats &theColorFormats, const Handle< OpenGl_Texture > &theDepthStencilTexture, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool Init (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const Standard_Integer theColorFormat, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into textures.
 
bool Init (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool InitLazy (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theViewportSizeX, const Standard_Integer theViewportSizeY, const Standard_Integer theColorFormat, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
bool InitLazy (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theViewportSizeX, const Standard_Integer theViewportSizeY, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 (Re-)initialize FBO with specified dimensions.
 
bool InitWithRB (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const Standard_Integer theColorFormat, const Standard_Integer 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.
 
virtual ~OpenGl_Resource ()
 Destructor. Inheritors should call Clean (NULL) within it.
 
virtual void DumpJson (Standard_OStream &theOStream, Standard_Integer 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 ()
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
Standard_Boolean 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.
 
Standard_Boolean IsKind (const Standard_CString 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.
 
Standard_Integer GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object.
 
Standard_Integer DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Member Functions

Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const OpenGl_ColorFormats &theColorFormats, const Handle< OpenGl_Texture > &theDepthStencilTexture, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const Standard_Integer theColorFormat, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into textures.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Graphic3d_Vec2i &theSize, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool Init (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const OpenGl_ColorFormats &theColorFormats, const Handle< OpenGl_Texture > &theDepthStencilTexture, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
bool Init (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const Standard_Integer theColorFormat, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into textures.
 
bool Init (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theSizeX, const Standard_Integer theSizeY, const OpenGl_ColorFormats &theColorFormats, const Standard_Integer theDepthFormat, const Standard_Integer theNbSamples=0)
 Initialize FBO for rendering into single/multiple color buffer and depth textures.
 
- Protected Member Functions inherited from OpenGl_FrameBuffer
Standard_Boolean isValidFrameBuffer () const
 

Protected Attributes

IDirect3DSurface9myD3dSurf
 D3D surface.
 
void * myD3dSurfShare
 D3D surface share handle in WDDM.
 
void * myGlD3dDevice
 WGL/D3D device handle.
 
void * myGlD3dSurf
 WGL/D3D surface handle.
 
Standard_Integer myLockCount
 locking counter
 
Standard_Boolean myD3dFallback
 indicates that FBO has been initialized without WGL/D3D interop
 
Standard_Boolean myIsSRGBReady
 indicates that color buffer is sRGB ready
 
- Protected Attributes inherited from OpenGl_FrameBuffer
Standard_Integer myInitVPSizeX
 viewport width specified during initialization (kept even on failure)
 
Standard_Integer myInitVPSizeY
 viewport height specified during initialization (kept even on failure)
 
Standard_Integer myVPSizeX
 viewport width (should be <= texture width)
 
Standard_Integer myVPSizeY
 viewport height (should be <= texture height)
 
Standard_Integer myNbSamples
 number of MSAA samples
 
OpenGl_ColorFormats myColorFormats
 sized format for color texture, GL_RGBA8 by default
 
Standard_Integer 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
 
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.
 
- Static Public Member Functions inherited from OpenGl_FrameBuffer
static Standard_Boolean BufferDump (const Handle< OpenGl_Context > &theGlCtx, const 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 inherited from OpenGl_FrameBuffer
static const unsigned int NO_FRAMEBUFFER = 0
 Helpful constants.
 
static const unsigned int NO_RENDERBUFFER = 0
 
- Protected Types inherited from OpenGl_FrameBuffer
typedef NCollection_Vector< Handle< OpenGl_Texture > > OpenGl_TextureArray
 

Detailed Description

Implements bridge FBO for direct rendering to Direct3D surfaces.

Constructor & Destructor Documentation

◆ D3DHost_FrameBuffer()

D3DHost_FrameBuffer::D3DHost_FrameBuffer ( )

Empty constructor.

◆ ~D3DHost_FrameBuffer()

D3DHost_FrameBuffer::~D3DHost_FrameBuffer ( )

Destructor, should be called after Release().

Member Function Documentation

◆ BindBuffer()

virtual void D3DHost_FrameBuffer::BindBuffer ( const Handle< OpenGl_Context > &  theCtx)
overridevirtual

Binds Direct3D objects for OpenGL drawing. Should be called before LockSurface() and followed by UnlockSurface();.

Reimplemented from OpenGl_FrameBuffer.

◆ D3dColorSurface()

IDirect3DSurface9 * D3DHost_FrameBuffer::D3dColorSurface ( )
inline

Returns D3D surface used as color buffer.

◆ D3dColorSurfaceShare()

void * D3DHost_FrameBuffer::D3dColorSurfaceShare ( )
inline

Returns WDDM handle for D3D color surface.

◆ D3dFallback()

Standard_Boolean D3DHost_FrameBuffer::D3dFallback ( ) const
inline

Returns TRUE if FBO has been initialized without WGL/D3D interop.

◆ Init() [1/7]

Standard_Boolean D3DHost_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theCtx,
IDirect3DDevice9 theD3DDevice,
const Standard_Boolean  theIsD3dEx,
const Standard_Integer  theSizeX,
const Standard_Integer  theSizeY 
)

Initializes OpenGL FBO for Direct3D interoperability or in fallback mode. Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA; depth-stencil pixel format is GL_DEPTH24_STENCIL8.

Parameters
theGlCtxcurrently bound OpenGL context
theD3DDeviced3d9 device
theIsD3dExd3d9 extended flag (for creating shared texture resource)
theSizeXtexture width
theSizeYtexture height
Returns
true on success

◆ Init() [2/7]

Standard_Boolean OpenGl_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Graphic3d_Vec2i theSize,
const OpenGl_ColorFormats theColorFormats,
const Handle< OpenGl_Texture > &  theDepthStencilTexture,
const Standard_Integer  theNbSamples = 0 
)
protected

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

◆ Init() [3/7]

Standard_Boolean OpenGl_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Graphic3d_Vec2i theSize,
const OpenGl_ColorFormats theColorFormats,
const Standard_Integer  theDepthFormat,
const Standard_Integer  theNbSamples = 0 
)
protected

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() [4/7]

Standard_Boolean OpenGl_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Graphic3d_Vec2i theSize,
const Standard_Integer  theColorFormat,
const Standard_Integer  theDepthFormat,
const Standard_Integer  theNbSamples = 0 
)
protected

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/7]

bool OpenGl_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Standard_Integer  theSizeX,
const Standard_Integer  theSizeY,
const OpenGl_ColorFormats theColorFormats,
const Handle< OpenGl_Texture > &  theDepthStencilTexture,
const Standard_Integer  theNbSamples = 0 
)
inlineprotected

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

Deprecated:
("Obsolete method, use Init() taking Graphic3d_Vec2i")

◆ Init() [6/7]

bool OpenGl_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Standard_Integer  theSizeX,
const Standard_Integer  theSizeY,
const OpenGl_ColorFormats theColorFormats,
const Standard_Integer  theDepthFormat,
const Standard_Integer  theNbSamples = 0 
)
inlineprotected

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

Deprecated:
("Obsolete method, use Init() taking Graphic3d_Vec2i")

◆ Init() [7/7]

bool OpenGl_FrameBuffer::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Standard_Integer  theSizeX,
const Standard_Integer  theSizeY,
const Standard_Integer  theColorFormat,
const Standard_Integer  theDepthFormat,
const Standard_Integer  theNbSamples = 0 
)
inlineprotected

Initialize FBO for rendering into textures.

Deprecated:
("Obsolete method, use Init() taking Graphic3d_Vec2i")

◆ InitD3dFallback()

Standard_Boolean D3DHost_FrameBuffer::InitD3dFallback ( const Handle< OpenGl_Context > &  theCtx,
IDirect3DDevice9 theD3DDevice,
const Standard_Boolean  theIsD3dEx,
const Standard_Integer  theSizeX,
const Standard_Integer  theSizeY,
const Standard_Integer  theDepthFormat 
)

Initializes OpenGL FBO + Direct3D surface for copying memory using fallback. Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.

Parameters
theGlCtxcurrently bound OpenGL context
theD3DDeviced3d9 device
theIsD3dExd3d9 extended flag (for creating shared texture resource)
theSizeXtexture width
theSizeYtexture height
theDepthFormatdepth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
Returns
true on success

◆ InitD3dInterop()

Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop ( const Handle< OpenGl_Context > &  theCtx,
IDirect3DDevice9 theD3DDevice,
const Standard_Boolean  theIsD3dEx,
const Standard_Integer  theSizeX,
const Standard_Integer  theSizeY,
const Standard_Integer  theDepthFormat 
)

Initializes OpenGL FBO for Direct3D interoperability. Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.

Parameters
theGlCtxcurrently bound OpenGL context
theD3DDeviced3d9 device
theIsD3dExd3d9 extended flag (for creating shared texture resource)
theSizeXtexture width
theSizeYtexture height
theDepthFormatdepth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
Returns
true on success

◆ IsSRGBReady()

Standard_Boolean D3DHost_FrameBuffer::IsSRGBReady ( ) const
inline

Returns TRUE if color buffer is sRGB ready; FALSE by default. Requires D3DSAMP_SRGBTEXTURE sampler parameter being set on D3D level for rendering D3D surface.

◆ LockSurface()

virtual void D3DHost_FrameBuffer::LockSurface ( const Handle< OpenGl_Context > &  theCtx)
virtual

Acquires D3D resource for OpenGL usage.

◆ registerD3dBuffer()

Standard_Boolean D3DHost_FrameBuffer::registerD3dBuffer ( const Handle< OpenGl_Context > &  theCtx)

Binds Direct3D color buffer to OpenGL texture.

◆ Release()

virtual void D3DHost_FrameBuffer::Release ( OpenGl_Context theCtx)
overridevirtual

Releases D3D and OpenGL resources.

Reimplemented from OpenGl_FrameBuffer.

◆ SetSRGBReady()

void D3DHost_FrameBuffer::SetSRGBReady ( Standard_Boolean  theIsReady)
inline

Set if color buffer is sRGB ready.

◆ UnlockSurface()

virtual void D3DHost_FrameBuffer::UnlockSurface ( const Handle< OpenGl_Context > &  theCtx)
virtual

Releases D3D resource.

Field Documentation

◆ myD3dFallback

Standard_Boolean D3DHost_FrameBuffer::myD3dFallback
protected

indicates that FBO has been initialized without WGL/D3D interop

◆ myD3dSurf

IDirect3DSurface9* D3DHost_FrameBuffer::myD3dSurf
protected

D3D surface.

◆ myD3dSurfShare

void* D3DHost_FrameBuffer::myD3dSurfShare
protected

D3D surface share handle in WDDM.

◆ myGlD3dDevice

void* D3DHost_FrameBuffer::myGlD3dDevice
protected

WGL/D3D device handle.

◆ myGlD3dSurf

void* D3DHost_FrameBuffer::myGlD3dSurf
protected

WGL/D3D surface handle.

◆ myIsSRGBReady

Standard_Boolean D3DHost_FrameBuffer::myIsSRGBReady
protected

indicates that color buffer is sRGB ready

◆ myLockCount

Standard_Integer D3DHost_FrameBuffer::myLockCount
protected

locking counter


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