chai3d::cFrameBuffer Class Reference

This class implements an OpenGL framebuffer. More...

#include <CFrameBuffer.h>

Inheritance diagram for chai3d::cFrameBuffer:

Public Member Functions

 cFrameBuffer ()
 Constructor of cFrameBuffer. More...
 
virtual ~cFrameBuffer ()
 Destructor of cFrameBuffer. More...
 
void setup (cCamera *a_camera=NULL, const unsigned int a_width=0, const unsigned int a_height=0, const bool a_enableImageBuffer=true, const bool a_enableDepthBuffer=true)
 This method initializes the framebuffer. More...
 
void renderView (const cEyeMode a_eyeMode=C_STEREO_LEFT_EYE)
 This method renders the framebuffer view. More...
 
void copyImageBuffer (cImagePtr a_image)
 This method copies the framebuffer content to an image. More...
 
void copyDepthBuffer (cImagePtr a_image)
 This method copies the depth buffer content to an image. More...
 
void setCamera (cCamera *a_camera)
 This method attaches a camera to the framebuffer. More...
 
cCameragetCamera ()
 This method returns a pointer to the camera attached to the framebuffer. More...
 
unsigned int getWidth () const
 This method returns the width in pixels of the framebuffer. More...
 
unsigned int getHeight () const
 This method returns the height in pixels of the framebuffer. More...
 
void setSize (const unsigned int a_width, const unsigned int a_height)
 This method sets the resolution of the framebuffer by defining its width and height in pixels. More...
 
bool renderInitialize ()
 This method initializes rendering to the framebuffer. More...
 
bool renderFinalize ()
 This method finalizes the rendering to the framebuffer. More...
 

Static Public Member Functions

static cFrameBufferPtr create ()
 Shared cFrameBuffer allocator. More...
 

Public Attributes

cTexture2dPtr m_imageBuffer
 Image buffer. More...
 
cTexture2dPtr m_depthBuffer
 Depth buffer. More...
 

Protected Attributes

bool m_useImageBuffer
 If true then image buffer is enabled, false otherwise. More...
 
bool m_useDepthBuffer
 If true then image buffer is enabled, false otherwise. More...
 
unsigned int m_width
 Width in pixels of the frame buffer. More...
 
unsigned int m_height
 Height in pixels of the frame buffer. More...
 
unsigned int m_prevWidth
 Last width value that was used when allocating texture size. More...
 
unsigned int m_prevHeight
 Last height value that was used when allocating texture size. More...
 
cCameram_camera
 Camera associated with this framebuffer. More...
 
GLuint m_fbo
 OpenGL frame buffer object. More...
 

Detailed Description

This class implements an OpenGL framebuffer.

Constructor & Destructor Documentation

chai3d::cFrameBuffer::cFrameBuffer ( )

Constructor of cFrameBuffer.

chai3d::cFrameBuffer::~cFrameBuffer ( )
virtual

Destructor of cFrameBuffer.

Member Function Documentation

static cFrameBufferPtr chai3d::cFrameBuffer::create ( )
inlinestatic
void chai3d::cFrameBuffer::setup ( cCamera a_camera = NULL,
const unsigned int  a_width = 0,
const unsigned int  a_height = 0,
const bool  a_useImageBuffer = true,
const bool  a_useDepthBuffer = true 
)

This method initializes the cFrameBuffer.

Parameters
a_cameraCamera to be attached to framebuffer.
a_widthWidth in pixels of framebuffer.
a_heightHeight in pixels of framebuffer.
a_useImageBufferIf true then framebuffer shall store color information.
a_useDepthBufferIf true then framebuffer shall store depth information.
void chai3d::cFrameBuffer::renderView ( const cEyeMode  a_eyeMode = C_STEREO_LEFT_EYE)

This method render the scene to the framebuffer.

Parameters
a_eyeModeWhen using stereo mode C_STEREO_PASSIVE_DUAL_DISPLAY, this argument specifies which eye view to render.
void chai3d::cFrameBuffer::copyImageBuffer ( cImagePtr  a_image)

This method copies the OpenGL image buffer content to an image.

Parameters
a_imageDestination image.
void chai3d::cFrameBuffer::copyDepthBuffer ( cImagePtr  a_image)

This method copies the OpenGL depth buffer content to an image.

Parameters
a_imageDestination image.
void chai3d::cFrameBuffer::setCamera ( cCamera a_camera)
inline
cCamera* chai3d::cFrameBuffer::getCamera ( )
inline
unsigned int chai3d::cFrameBuffer::getWidth ( ) const
inline
unsigned int chai3d::cFrameBuffer::getHeight ( ) const
inline
void chai3d::cFrameBuffer::setSize ( const unsigned int  a_width,
const unsigned int  a_height 
)

This method sets the size of the framebuffer by defining the width and height in pixel.

Parameters
a_widthWidth of frame buffer in pixels.
a_heightHeight of frame buffer in pixels.
bool chai3d::cFrameBuffer::renderInitialize ( )

This method initializes the framebuffer so that rendering of the scene can occur. This method is for advanced users only; in practice you should simply call method renderView() to render the framebuffer.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cFrameBuffer::renderFinalize ( )

This method finalizes the rendering of the framebuffer. This method is for advanced users only; in practice you should simply call method renderView() to render the framebuffer.

Returns
true if the operation succeeds, false otherwise.

Member Data Documentation

cTexture2dPtr chai3d::cFrameBuffer::m_imageBuffer
cTexture2dPtr chai3d::cFrameBuffer::m_depthBuffer
bool chai3d::cFrameBuffer::m_useImageBuffer
protected
bool chai3d::cFrameBuffer::m_useDepthBuffer
protected
unsigned int chai3d::cFrameBuffer::m_width
protected
unsigned int chai3d::cFrameBuffer::m_height
protected
unsigned int chai3d::cFrameBuffer::m_prevWidth
protected
unsigned int chai3d::cFrameBuffer::m_prevHeight
protected
cCamera* chai3d::cFrameBuffer::m_camera
protected
GLuint chai3d::cFrameBuffer::m_fbo
protected

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