Open CASCADE Technology  7.0.0
Public 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. More...
 
 ~D3DHost_FrameBuffer ()
 Destructor, should be called after Release(). More...
 
virtual void Release (OpenGl_Context *theCtx) override
 Releases D3D and OpenGL resources. More...
 
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. More...
 
Standard_Boolean registerD3dBuffer (const Handle< OpenGl_Context > &theCtx)
 Binds Direct3D color buffer to OpenGL texture. More...
 
virtual void BindBuffer (const Handle< OpenGl_Context > &theCtx) override
 Binds Direct3D objects for OpenGL drawing. Should be called before LockSurface() and followed by UnlockSurface();. More...
 
virtual void LockSurface (const Handle< OpenGl_Context > &theCtx)
 Acquires D3D resource for OpenGL usage. More...
 
virtual void UnlockSurface (const Handle< OpenGl_Context > &theCtx)
 Releases D3D resource. More...
 
IDirect3DSurface9 * D3dColorSurface ()
 Returns D3D surface used as color buffer. More...
 
void * D3dColorSurfaceShare ()
 Returns WDDM hande for D3D color surface. More...
 
- Public Member Functions inherited from OpenGl_FrameBuffer
 OpenGl_FrameBuffer ()
 Empty constructor. More...
 
virtual ~OpenGl_FrameBuffer ()
 Destructor. More...
 
GLsizei NbSamples () const
 Number of multisampling samples. More...
 
bool HasColor () const
 Return true if FBO has been created with color attachment. More...
 
bool HasDepth () const
 Return true if FBO has been created with depth attachment. More...
 
GLsizei GetSizeX () const
 Textures width. More...
 
GLsizei GetSizeY () const
 Textures height. More...
 
GLsizei GetVPSizeX () const
 Viewport width. More...
 
GLsizei GetVPSizeY () const
 Viewport height. More...
 
Standard_Boolean IsValid () const
 Returns true if current object was initialized. More...
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const GLsizei theSizeX, const GLsizei theSizeY, const GLint theColorFormat, const GLint theDepthFormat, const GLsizei theNbSamples=0)
 Initialize FBO for rendering into textures. More...
 
Standard_Boolean InitLazy (const Handle< OpenGl_Context > &theGlCtx, const GLsizei theViewportSizeX, const GLsizei theViewportSizeY, const GLint theColorFormat, const GLint theDepthFormat, const GLsizei theNbSamples=0)
 (Re-)initialize FBO with specified dimensions. More...
 
Standard_Boolean InitLazy (const Handle< OpenGl_Context > &theGlCtx, const OpenGl_FrameBuffer &theFbo)
 (Re-)initialize FBO with properties taken from another FBO. More...
 
Standard_Boolean InitWithRB (const Handle< OpenGl_Context > &theGlCtx, const GLsizei theSizeX, const GLsizei theSizeY, const GLint theColorFormat, const GLint theDepthFormat, const GLuint 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). More...
 
Standard_Boolean InitWrapper (const Handle< OpenGl_Context > &theGlCtx)
 Initialize class from currently bound FBO. Retrieved OpenGL objects will not be destroyed on Release. More...
 
void SetupViewport (const Handle< OpenGl_Context > &theGlCtx)
 Setup viewport to render into FBO. More...
 
void ChangeViewport (const GLsizei theVPSizeX, const GLsizei theVPSizeY)
 Override viewport settings. More...
 
virtual void BindDrawBuffer (const Handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for drawing GL_DRAW_FRAMEBUFFER (to render into the texture). More...
 
virtual void BindReadBuffer (const Handle< OpenGl_Context > &theGlCtx)
 Bind frame buffer for reading GL_READ_FRAMEBUFFER. More...
 
virtual void UnbindBuffer (const Handle< OpenGl_Context > &theGlCtx)
 Unbind frame buffer. More...
 
const Handle< OpenGl_Texture > & ColorTexture () const
 Returns the color texture. More...
 
const Handle< OpenGl_Texture > & DepthStencilTexture () const
 Returns the depth-stencil texture. More...
 
GLuint ColorRenderBuffer () const
 Returns the color Render Buffer. More...
 
GLuint DepthStencilRenderBuffer () const
 Returns the depth Render Buffer. More...
 
- Public Member Functions inherited from OpenGl_Resource
 OpenGl_Resource ()
 Empty constructor. More...
 
virtual ~OpenGl_Resource ()
 Destructor. Inheritors should call Clean (NULL) within it. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
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. More...
 
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. More...
 
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. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Protected Attributes

IDirect3DSurface9 * myD3dSurf
 D3D surface. More...
 
void * myD3dSurfShare
 D3D surface share handle in WDDM. More...
 
void * myGlD3dDevice
 WGL/D3D device handle. More...
 
void * myGlD3dSurf
 WGL/D3D surface handle. More...
 
Standard_Integer myLockCount
 locking counter More...
 
- Protected Attributes inherited from OpenGl_FrameBuffer
GLsizei myVPSizeX
 viewport width (should be <= texture width) More...
 
GLsizei myVPSizeY
 viewport height (should be <= texture height) More...
 
GLsizei myNbSamples
 number of MSAA samples More...
 
GLint myColorFormat
 sized format for color texture, GL_RGBA8 by default More...
 
GLint myDepthFormat
 sized format for depth-stencil texture, GL_DEPTH24_STENCIL8 by default More...
 
GLuint myGlFBufferId
 FBO object ID. More...
 
GLuint myGlColorRBufferId
 color Render Buffer object (alternative to myColorTexture) More...
 
GLuint myGlDepthRBufferId
 depth-stencil Render Buffer object (alternative to myDepthStencilTexture) More...
 
bool myIsOwnBuffer
 flag indicating that FBO should be deallocated by this class More...
 
Handle< OpenGl_TexturemyColorTexture
 color texture object More...
 
Handle< OpenGl_TexturemyDepthStencilTexture
 depth-stencil texture object More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 
- Static Public Attributes inherited from OpenGl_FrameBuffer
static const GLuint NO_FRAMEBUFFER = 0
 Helpful constants. More...
 
static const GLuint NO_RENDERBUFFER = 0
 
- Protected Member Functions inherited from OpenGl_FrameBuffer
Standard_Boolean isValidFrameBuffer () const
 

Detailed Description

Implements bridge FBO for direct rendering to Direct3D surfaces.

Constructor & Destructor Documentation

D3DHost_FrameBuffer::D3DHost_FrameBuffer ( )

Empty constructor.

D3DHost_FrameBuffer::~D3DHost_FrameBuffer ( )

Destructor, should be called after Release().

Member Function Documentation

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.

IDirect3DSurface9* D3DHost_FrameBuffer::D3dColorSurface ( )
inline

Returns D3D surface used as color buffer.

void* D3DHost_FrameBuffer::D3dColorSurfaceShare ( )
inline

Returns WDDM hande for D3D color surface.

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.

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

Acquires D3D resource for OpenGL usage.

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

Binds Direct3D color buffer to OpenGL texture.

virtual void D3DHost_FrameBuffer::Release ( OpenGl_Context theCtx)
overridevirtual

Releases D3D and OpenGL resources.

Reimplemented from OpenGl_FrameBuffer.

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

Releases D3D resource.

Field Documentation

IDirect3DSurface9* D3DHost_FrameBuffer::myD3dSurf
protected

D3D surface.

void* D3DHost_FrameBuffer::myD3dSurfShare
protected

D3D surface share handle in WDDM.

void* D3DHost_FrameBuffer::myGlD3dDevice
protected

WGL/D3D device handle.

void* D3DHost_FrameBuffer::myGlD3dSurf
protected

WGL/D3D surface handle.

Standard_Integer D3DHost_FrameBuffer::myLockCount
protected

locking counter


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