cinder::gl::Fbo Class Reference

Represents a reference-counted OpenGL Framebuffer Object. More...

#include <Fbo.h>

List of all members.

Classes

struct  Format
struct  Obj

Public Member Functions

 Fbo ()
 Creates a NULL FBO.
 Fbo (int width, int height, Format format=Format())
 Creates an FBO width pixels wide and height pixels high, using Fbo::Format format.
 Fbo (int width, int height, bool alpha, bool color=true, bool depth=true)
 Creates an FBO width pixels wide and height pixels high, with an optional alpha channel, color buffer and depth buffer.
int getWidth () const
 Returns the width of the FBO in pixels.
int getHeight () const
 Returns the height of the FBO in pixels.
Vec2i getSize () const
 Returns the size of the FBO in pixels.
Area getBounds () const
 Returns the bounding area of the FBO in pixels.
float getAspectRatio () const
 Returns the aspect ratio of the FBO.
const FormatgetFormat () const
 Returns the Fbo::Format of this FBO.
GLenum getTarget () const
 Returns the texture target for this FBO. Typically GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB.
TexturegetTexture ()
 Returns a reference to the color texture of the FBO.
TexturegetDepthTexture ()
 Returns a reference to the depth texture of the FBO. Depth textures are not created when multisampling is used.
void bindTexture (int textureUnit=0)
 Binds the color texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero.
void unbindTexture ()
 Unbinds the texture associated with an Fbo's target.
void bindDepthTexture (int textureUnit=0)
 Binds the depth texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero.
void bindFramebuffer ()
 Binds the Fbo as the currently active framebuffer, meaning it will receive the results of all subsequent rendering until it is unbound.

Static Public Member Functions

static void unbindFramebuffer ()
 Unbinds the Fbo as the currently active framebuffer, restoring the primary context as the target for all subsequent rendering.
static GLint getMaxSamples ()
 Returns the maximum number of samples the graphics card is capable of using per pixel in MSAA for an Fbo.

Protected Member Functions

void init ()
bool initMultisample (bool csaa)
void resolveTexture () const
void updateMipmaps (bool bindFirst) const
bool checkStatus (class FboExceptionInvalidSpecification *resultExc)

Protected Attributes

shared_ptr< ObjmObj

Static Protected Attributes

static GLint sMaxSamples = -1



typedef shared_ptr< Obj > Fbo::* unspecified_bool_type
 Emulates shared_ptr-like behavior.
 operator unspecified_bool_type ()
 Emulates shared_ptr-like behavior.
void reset ()
 Emulates shared_ptr-like behavior.

Detailed Description

Represents a reference-counted OpenGL Framebuffer Object.

FBOs are used for doing off-screen rendering, including rendering to a texture. An FBO can capture draw commands that would normally go to the screen, and can be used to implement a large variety of techniques, particularly post-processing effects like blurs, depth-of-field and the like. FBOs are formally specified in the extension GL_EXT_framebuffer_object.

See also:
Guide to Framebuffer Objects (FBOs)

Member Typedef Documentation

typedef shared_ptr<Obj> Fbo::* cinder::gl::Fbo::unspecified_bool_type

Emulates shared_ptr-like behavior.


Constructor & Destructor Documentation

cinder::gl::Fbo::Fbo (  ) 

Creates a NULL FBO.

cinder::gl::Fbo::Fbo ( int  width,
int  height,
Format  format = Format() 
)

Creates an FBO width pixels wide and height pixels high, using Fbo::Format format.

cinder::gl::Fbo::Fbo ( int  width,
int  height,
bool  alpha,
bool  color = true,
bool  depth = true 
)

Creates an FBO width pixels wide and height pixels high, with an optional alpha channel, color buffer and depth buffer.


Member Function Documentation

int cinder::gl::Fbo::getWidth (  )  const

Returns the width of the FBO in pixels.

int cinder::gl::Fbo::getHeight (  )  const

Returns the height of the FBO in pixels.

Vec2i cinder::gl::Fbo::getSize (  )  const

Returns the size of the FBO in pixels.

Area cinder::gl::Fbo::getBounds (  )  const

Returns the bounding area of the FBO in pixels.

float cinder::gl::Fbo::getAspectRatio (  )  const

Returns the aspect ratio of the FBO.

const Format& cinder::gl::Fbo::getFormat (  )  const

Returns the Fbo::Format of this FBO.

GLenum cinder::gl::Fbo::getTarget (  )  const

Returns the texture target for this FBO. Typically GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB.

Texture & cinder::gl::Fbo::getTexture (  ) 

Returns a reference to the color texture of the FBO.

Texture & cinder::gl::Fbo::getDepthTexture (  ) 

Returns a reference to the depth texture of the FBO. Depth textures are not created when multisampling is used.

void cinder::gl::Fbo::bindTexture ( int  textureUnit = 0  ) 

Binds the color texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero.

void cinder::gl::Fbo::unbindTexture (  ) 

Unbinds the texture associated with an Fbo's target.

void cinder::gl::Fbo::bindDepthTexture ( int  textureUnit = 0  ) 

Binds the depth texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero.

void cinder::gl::Fbo::bindFramebuffer (  ) 

Binds the Fbo as the currently active framebuffer, meaning it will receive the results of all subsequent rendering until it is unbound.

void cinder::gl::Fbo::unbindFramebuffer (  )  [static]

Unbinds the Fbo as the currently active framebuffer, restoring the primary context as the target for all subsequent rendering.

GLint cinder::gl::Fbo::getMaxSamples (  )  [static]

Returns the maximum number of samples the graphics card is capable of using per pixel in MSAA for an Fbo.

void cinder::gl::Fbo::init (  )  [protected]
bool cinder::gl::Fbo::initMultisample ( bool  csaa  )  [protected]
void cinder::gl::Fbo::resolveTexture (  )  const [protected]
void cinder::gl::Fbo::updateMipmaps ( bool  bindFirst  )  const [protected]
bool cinder::gl::Fbo::checkStatus ( class FboExceptionInvalidSpecification resultExc  )  [protected]
cinder::gl::Fbo::operator unspecified_bool_type (  ) 

Emulates shared_ptr-like behavior.

void cinder::gl::Fbo::reset (  ) 

Emulates shared_ptr-like behavior.


Member Data Documentation

shared_ptr<Obj> cinder::gl::Fbo::mObj [protected]
GLint cinder::gl::Fbo::sMaxSamples = -1 [static, protected]

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