Represents a reference-counted OpenGL Framebuffer Object. More...
#include <Fbo.h>
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 Format & | getFormat () 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 . | |
Texture & | getTexture (int attachment=0) |
Returns a reference to the color texture of the FBO. attachment specifies which attachment in the case of multiple color buffers. | |
Texture & | getDepthTexture () |
Returns a reference to the depth texture of the FBO. | |
void | bindTexture (int textureUnit=0, int attachment=0) |
Binds the color texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero. Optionally binds to a multitexturing unit when textureUnit is non-zero. attachment specifies which color buffer in the case of multiple attachments. | |
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. | |
void | bindFramebuffer () |
Binds the Fbo as the currently active framebuffer, meaning it will receive the results of all subsequent rendering until it is unbound. | |
GLuint | getId () const |
Returns the ID of the framebuffer itself. For antialiased FBOs this is the ID of the output multisampled FBO. | |
GLuint | getResolveId () const |
For antialiased FBOs this returns the ID of the mirror FBO designed for reading, where the multisampled render buffers are resolved to. For non-antialised, this is the equivalent to getId(). | |
void | blitTo (Fbo dst, const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) const |
Copies to FBO dst from srcArea to using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT ) and/or depth(GL_DEPTH_BUFFER_BIT ). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system. | |
void | blitToScreen (const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) const |
Copies to the screen from Area srcArea to using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT ) and/or depth(GL_DEPTH_BUFFER_BIT ). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system. | |
void | blitFromScreen (const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) |
Copies from the screen from Area srcArea to using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT ) and/or depth(GL_DEPTH_BUFFER_BIT ). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system. | |
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. | |
static GLint | getMaxAttachments () |
Returns the maximum number of color attachments the graphics card is capable of using for an Fbo. | |
Protected Member Functions | |
void | init () |
bool | initMultisample (bool csaa) |
void | resolveTextures () const |
void | updateMipmaps (bool bindFirst, int attachment) const |
bool | checkStatus (class FboExceptionInvalidSpecification *resultExc) |
Protected Attributes | |
shared_ptr< Obj > | mObj |
Static Protected Attributes | |
static GLint | sMaxSamples = -1 |
static GLint | sMaxAttachments = -1 |
| |
typedef shared_ptr< Obj > Fbo::* | unspecified_bool_type |
Emulates shared_ptr-like behavior. | |
operator unspecified_bool_type () const | |
Emulates shared_ptr-like behavior. | |
void | reset () |
Emulates shared_ptr-like behavior. |
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
.
typedef shared_ptr<Obj> Fbo::* cinder::gl::Fbo::unspecified_bool_type |
Emulates shared_ptr-like behavior.
cinder::gl::Fbo::Fbo | ( | ) |
Creates a NULL FBO.
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.
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 | ( | int | attachment = 0 |
) |
Returns a reference to the color texture of the FBO. attachment specifies which attachment in the case of multiple color buffers.
Texture & cinder::gl::Fbo::getDepthTexture | ( | ) |
Returns a reference to the depth texture of the FBO.
void cinder::gl::Fbo::bindTexture | ( | int | textureUnit = 0 , |
|
int | attachment = 0 | |||
) |
Binds the color texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero. Optionally binds to a multitexturing unit when textureUnit is non-zero. attachment specifies which color buffer in the case of multiple attachments.
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.
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.
GLuint cinder::gl::Fbo::getId | ( | ) | const |
Returns the ID of the framebuffer itself. For antialiased FBOs this is the ID of the output multisampled FBO.
GLuint cinder::gl::Fbo::getResolveId | ( | ) | const |
For antialiased FBOs this returns the ID of the mirror FBO designed for reading, where the multisampled render buffers are resolved to. For non-antialised, this is the equivalent to getId().
void cinder::gl::Fbo::blitTo | ( | Fbo | dst, | |
const Area & | srcArea, | |||
const Area & | dstArea, | |||
GLenum | filter = GL_NEAREST , |
|||
GLbitfield | mask = GL_COLOR_BUFFER_BIT | |||
) | const |
Copies to FBO dst from srcArea to using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT
) and/or depth(GL_DEPTH_BUFFER_BIT
). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system.
void cinder::gl::Fbo::blitToScreen | ( | const Area & | srcArea, | |
const Area & | dstArea, | |||
GLenum | filter = GL_NEAREST , |
|||
GLbitfield | mask = GL_COLOR_BUFFER_BIT | |||
) | const |
Copies to the screen from Area srcArea to using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT
) and/or depth(GL_DEPTH_BUFFER_BIT
). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system.
void cinder::gl::Fbo::blitFromScreen | ( | const Area & | srcArea, | |
const Area & | dstArea, | |||
GLenum | filter = GL_NEAREST , |
|||
GLbitfield | mask = GL_COLOR_BUFFER_BIT | |||
) |
Copies from the screen from Area srcArea to using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT
) and/or depth(GL_DEPTH_BUFFER_BIT
). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system.
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.
GLint cinder::gl::Fbo::getMaxAttachments | ( | ) | [static] |
Returns the maximum number of color attachments the graphics card is capable of using for an Fbo.
void cinder::gl::Fbo::init | ( | ) | [protected] |
bool cinder::gl::Fbo::initMultisample | ( | bool | csaa | ) | [protected] |
void cinder::gl::Fbo::resolveTextures | ( | ) | const [protected] |
void cinder::gl::Fbo::updateMipmaps | ( | bool | bindFirst, | |
int | attachment | |||
) | const [protected] |
bool cinder::gl::Fbo::checkStatus | ( | class FboExceptionInvalidSpecification * | resultExc | ) | [protected] |
cinder::gl::Fbo::operator unspecified_bool_type | ( | ) | const |
Emulates shared_ptr-like behavior.
void cinder::gl::Fbo::reset | ( | ) |
Emulates shared_ptr-like behavior.
shared_ptr<Obj> cinder::gl::Fbo::mObj [protected] |
GLint cinder::gl::Fbo::sMaxSamples = -1 [static, protected] |
GLint cinder::gl::Fbo::sMaxAttachments = -1 [static, protected] |