Vis 2 Demo  1.0
Technical illustration type real-time rendering of geometry
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
vis2::FramebufferObject Class Reference

This class builds a Frame Buffer Object (FBO) for post-processing effects. More...

Public Member Functions

 FramebufferObject (const unsigned int _vp_width, const unsigned int _vp_height, const bool _color_only)
 Constructs a FBO for rendering to texture(s) More...
 
 ~FramebufferObject ()
 Destructor. More...
 
unsigned int getFBOStatus () const
 This function returns the state of the FBO. More...
 
void bindFramebufferObject (const float _r, const float _g, const float _b, const float _a)
 Binds this framebuffer for rendering. More...
 
void releaseFramebufferObject ()
 Unbinds this framebuffer. More...
 
TexturegetFBOColorTexture ()
 Getter for the rendered FBO texture : color. More...
 
TexturegetFBODepthTexture ()
 Getter for the rendered FBO texture : depth. More...
 

Private Member Functions

 FramebufferObject (const FramebufferObject &)
 Hidden copy-constructor. More...
 

Private Attributes

bool color_only
 true if only a color attachemnt is bound to the FBO, false otherwise More...
 
GLuint fbo_handle
 handle to the frame buffer object for rendering to texture More...
 
bool fbo_setup_done
 signifies if the setup for the frame buffer object was completed More...
 
unsigned int fbo_status
 holds the state of the FBO More...
 
unsigned int fbo_width
 is the width of the viewport, which is the same for all attachments of the FBO More...
 
unsigned int fbo_height
 is the height of the viewport, which is the same for all attachments of the FBO More...
 
GLuint fbo_renderbuffer_color_handle
 stores the name of the renderable object - in this case a renderbuffer for color More...
 
GLuint fbo_renderbuffer_depth_handle
 stores the name of the renderable object - in this case a renderbuffer for depth More...
 
Texturefbo_color_texture
 stores the result of the render to texture function : color buffer More...
 
Texturefbo_depth_texture
 stores the result of the render to texture function : depth buffer More...
 

Detailed Description

This class builds a Frame Buffer Object (FBO) for post-processing effects.

The class builds FBOs with only a color or with both a color and a depth attachment.
The depth test can be performed only on FBOs with a depth attachment.

Definition at line 18 of file FramebufferObject.h.

Constructor & Destructor Documentation

FramebufferObject::FramebufferObject ( const unsigned int  _vp_width,
const unsigned int  _vp_height,
const bool  _color_only 
)

Constructs a FBO for rendering to texture(s)

Any of the shader programs can render to these textures.

Parameters
[in]_vp_widthis the viewport width,
[in]_vp_heightis the viewport height,
[in]_color_only: if true only a color attachment is prepared.
Per default a color and depth textures are prepared.

Definition at line 5 of file FramebufferObject.cpp.

FramebufferObject::~FramebufferObject ( )

Destructor.

Deletes the FBO and both textures associated with its attachments.

Definition at line 78 of file FramebufferObject.cpp.

vis2::FramebufferObject::FramebufferObject ( const FramebufferObject )
private

Hidden copy-constructor.

Member Function Documentation

void FramebufferObject::bindFramebufferObject ( const float  _r,
const float  _g,
const float  _b,
const float  _a 
)

Binds this framebuffer for rendering.

This function is called directly BEFORE a drawing command.

Parameters
[in]_ris the red channel of the viewport background color in the interval [0.0 1.0],
[in]_gis the green channel of the viewport background color in the interval [0.0 1.0],
[in]_bis the blue channel of the viewport background color in the interval [0.0 1.0],
[in]_ais the alpha channel of the viewport background color in the interval [0.0 1.0].

Definition at line 89 of file FramebufferObject.cpp.

Texture* vis2::FramebufferObject::getFBOColorTexture ( )
inline

Getter for the rendered FBO texture : color.

Definition at line 59 of file FramebufferObject.h.

Texture* vis2::FramebufferObject::getFBODepthTexture ( )
inline

Getter for the rendered FBO texture : depth.

Definition at line 61 of file FramebufferObject.h.

unsigned int vis2::FramebufferObject::getFBOStatus ( ) const
inline

This function returns the state of the FBO.

Returns
VIS2_FBO_SETUP_SUCCESS or VIS2_FBO_SETUP_FAIL

Definition at line 40 of file FramebufferObject.h.

void FramebufferObject::releaseFramebufferObject ( )

Unbinds this framebuffer.

This function is called directly AFTER a drawing command.
It binds the FBO, and clears the viewport for rendering.

Definition at line 106 of file FramebufferObject.cpp.

Member Data Documentation

bool vis2::FramebufferObject::color_only
private

true if only a color attachemnt is bound to the FBO, false otherwise

Definition at line 67 of file FramebufferObject.h.

Texture* vis2::FramebufferObject::fbo_color_texture
private

stores the result of the render to texture function : color buffer

Definition at line 76 of file FramebufferObject.h.

Texture* vis2::FramebufferObject::fbo_depth_texture
private

stores the result of the render to texture function : depth buffer

Definition at line 77 of file FramebufferObject.h.

GLuint vis2::FramebufferObject::fbo_handle
private

handle to the frame buffer object for rendering to texture

Definition at line 69 of file FramebufferObject.h.

unsigned int vis2::FramebufferObject::fbo_height
private

is the height of the viewport, which is the same for all attachments of the FBO

Definition at line 73 of file FramebufferObject.h.

GLuint vis2::FramebufferObject::fbo_renderbuffer_color_handle
private

stores the name of the renderable object - in this case a renderbuffer for color

Definition at line 74 of file FramebufferObject.h.

GLuint vis2::FramebufferObject::fbo_renderbuffer_depth_handle
private

stores the name of the renderable object - in this case a renderbuffer for depth

Definition at line 75 of file FramebufferObject.h.

bool vis2::FramebufferObject::fbo_setup_done
private

signifies if the setup for the frame buffer object was completed

Definition at line 70 of file FramebufferObject.h.

unsigned int vis2::FramebufferObject::fbo_status
private

holds the state of the FBO

Definition at line 71 of file FramebufferObject.h.

unsigned int vis2::FramebufferObject::fbo_width
private

is the width of the viewport, which is the same for all attachments of the FBO

Definition at line 72 of file FramebufferObject.h.


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