This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
#include <ofFbo.h>

Public Types | |
typedef ofFboSettings | Settings |
ofFbo::Settings is currently deprecated in favor of the ofFboSettings struct | |
Public Member Functions | |
ofFbo () | |
ofFbo (const ofFbo &mom) | |
ofFbo & | operator= (const ofFbo &fbo) |
ofFbo (ofFbo &&mom) | |
ofFbo & | operator= (ofFbo &&fbo) |
virtual | ~ofFbo () |
void | allocate (int width, int height, int internalformat=GL_RGBA, int numSamples=0) |
void | allocate (ofFboSettings settings=ofFboSettings(nullptr)) |
bool | isAllocated () const |
OF_DEPRECATED_MSG ("Use clear() instead", void destroy()) | |
void | clear () |
void | clearColorBuffer (const ofFloatColor &color) |
void | clearColorBuffer (size_t buffer_idx, const ofFloatColor &color) |
void | clearDepthBuffer (float value) |
void | clearStencilBuffer (int value) |
void | clearDepthStencilBuffer (float depth, int stencil) |
void | draw (float x, float y) const |
Draw at a position at the native size. | |
void | draw (float x, float y, float width, float height) const |
Draw at a position with the specified size. | |
void | setAnchorPercent (float xPct, float yPct) |
Set the anchor point the item is drawn around as a percentage. | |
void | setAnchorPoint (float x, float y) |
Set the anchor point the item is drawn around in pixels. | |
void | resetAnchor () |
Reset the anchor point to (0, 0). | |
void | setDefaultTextureIndex (int defaultTexture) |
int | getDefaultTextureIndex () const |
OF_DEPRECATED_MSG ("Use getTexture()", ofTexture &getTextureReference()) | |
OF_DEPRECATED_MSG ("Use getTexture()", ofTexture &getTextureReference(int attachmentPoint)) | |
ofTexture & | getTexture () |
ofTexture & | getTexture (int attachmentPoint) |
ofTexture & | getDepthTexture () |
OF_DEPRECATED_MSG ("Use getTexture()", const ofTexture &getTextureReference() const) | |
OF_DEPRECATED_MSG ("Use getTexture()", const ofTexture &getTextureReference(int attachmentPoint) const) | |
const ofTexture & | getTexture () const |
const ofTexture & | getTexture (int attachmentPoint) const |
const ofTexture & | getDepthTexture () const |
void | setUseTexture (bool) |
Enable or disable internal ofTexture use. | |
bool | isUsingTexture () const |
OF_DEPRECATED_MSG ("Use begin(OF_FBOMODE_NODEFAULTS) instead", void begin(bool setupScreen) const) | |
void | begin (ofFboMode mode=OF_FBOMODE_PERSPECTIVE|OF_FBOMODE_MATRIXFLIP) const |
void | end () const |
Ends the current framebuffer render context. | |
void | readToPixels (ofPixels &pixels, int attachmentPoint=0) const |
void | readToPixels (ofShortPixels &pixels, int attachmentPoint=0) const |
void | readToPixels (ofFloatPixels &pixels, int attachmentPoint=0) const |
void | copyTo (ofBufferObject &buffer) const |
Copy the fbo to an ofBufferObject. | |
float | getWidth () const |
Get the width. | |
float | getHeight () const |
Get the height. | |
void | bind () const |
Bind OpenGL GL_FRAMEBUFFER target to this ofFbo. | |
void | unbind () const |
Unbinds OpenGL framebuffer target and restores the OpenGL framebuffer render target to whatever this ofFbo stores in previousFramebufferBinding. | |
void | flagDirty () const |
check whether attached MSAA buffers need updating | |
void | updateTexture (int attachmentPoint) |
Explicityl resolve MSAA render buffers into textures. | |
bool | checkStatus () const |
void | createAndAttachTexture (GLenum internalFormat, GLenum attachmentPoint) |
void | attachTexture (ofTexture &texture, GLenum internalFormat, GLenum attachmentPoint) |
GLuint | createAndAttachRenderbuffer (GLenum internalFormat, GLenum attachmentPoint) |
void | createAndAttachDepthStencilTexture (GLenum target, GLint internalformat, GLenum attachment) |
void | createAndAttachDepthStencilTexture (GLenum target, GLint internalformat, GLenum attachment, GLenum transferFormat, GLenum transferType) |
int | getNumTextures () const |
void | setActiveDrawBuffer (int i) |
void | setActiveDrawBuffers (const std::vector< int > &i) |
void | activateAllDrawBuffers () |
OF_DEPRECATED_MSG ("Use getId()", GLuint getFbo() const) | |
GLuint | getId () const |
returns id of the underlying GL object for advanced actions | |
GLuint | getIdDrawBuffer () const |
GLuint | getDepthBuffer () const |
GLuint | getStencilBuffer () const |
virtual void | draw (float x, float y) const |
Draw at a position at the native size. | |
virtual void | draw (float x, float y, float w, float h) const=0 |
Draw at a position with the specified size. | |
virtual void | draw (const glm::vec2 &point) const |
Draw at a position at the native size. | |
virtual void | draw (const ofRectangle &rect) const |
Draw at a position and size specified by a rectangle. | |
virtual void | draw (const glm::vec2 &point, float w, float h) const |
Draw at a position. | |
![]() | |
virtual | ~ofBaseDraws () |
Destroy the abstract object. | |
![]() | |
virtual | ~ofBaseHasTexture () |
Destroy the ofBaseHasTexture. | |
Static Public Member Functions | |
static bool | checkGLSupport () |
static int | maxColorAttachments () |
static int | maxDrawBuffers () |
static int | maxSamples () |
Member Typedef Documentation
◆ Settings
typedef ofFboSettings ofFbo::Settings |
ofFbo::Settings is currently deprecated in favor of the ofFboSettings struct
Constructor & Destructor Documentation
◆ ofFbo() [1/3]
ofFbo::ofFbo | ( | ) |
◆ ofFbo() [2/3]
ofFbo::ofFbo | ( | const ofFbo & | mom | ) |
◆ ofFbo() [3/3]
ofFbo::ofFbo | ( | ofFbo && | mom | ) |
◆ ~ofFbo()
|
virtual |
Member Function Documentation
◆ activateAllDrawBuffers()
void ofFbo::activateAllDrawBuffers | ( | ) |
◆ allocate() [1/2]
void ofFbo::allocate | ( | int | width, |
int | height, | ||
int | internalformat = GL_RGBA , |
||
int | numSamples = 0 |
||
) |
◆ allocate() [2/2]
void ofFbo::allocate | ( | ofFboSettings | settings = ofFboSettings(nullptr) | ) |
◆ attachTexture()
void ofFbo::attachTexture | ( | ofTexture & | texture, |
GLenum | internalFormat, | ||
GLenum | attachmentPoint | ||
) |
◆ begin()
void ofFbo::begin | ( | ofFboMode | mode = OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP | ) | const |
Sets up the framebuffer and binds it for rendering.
The mode parameter indicates which defaults are set when binding the fbo.
The default OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP will set the screen perspective to the OF default for the fbo size, the correct viewport to cover the full fbo and will flip the orientation matrix in y so when drawing the fbo later or accesing it from a shader it's correctly oriented
Passing OF_FBOMODE_PERSPECTIVE will only set perspective and viewport
Passing OF_FBOMODE_MATRIXFLIP won't set the perspective but will flip the matrix.
Passing OF_FBOMODE_NODEFAULTS won't change anything and just bind the fbo and set it as current rendering surface in OF
- Warning
- This is a convenience method, and is considered unsafe in multi-window and/or multi-renderer scenarios. If you use more than one renderer, use each renderer's explicit void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) method instead.
◆ bind()
void ofFbo::bind | ( | ) | const |
Bind OpenGL GL_FRAMEBUFFER target to this ofFbo.
- Warning
- If you use this method, you need to manually keep track of the currently bound framebuffer, if you ever want to restore state.
- use ofBaseGLRenderer::getCurrentFramebuffer() to query the current framebuffer binding state within the renderer.
- Better, use the renderer's explicit method: ofBaseGLRenderer::bind(const ofFbo & fbo) to bind the fbo, to allow the renderer to keep track of any bound fbos.
- See also
- unbind()
- virtual void ofBaseGLRenderer::bind(const ofFbo & fbo)
◆ checkGLSupport()
|
static |
◆ checkStatus()
bool ofFbo::checkStatus | ( | ) | const |
◆ clear()
void ofFbo::clear | ( | ) |
◆ clearColorBuffer() [1/2]
void ofFbo::clearColorBuffer | ( | const ofFloatColor & | color | ) |
glClearBufferfv(GL_COLOR, 0...)
◆ clearColorBuffer() [2/2]
void ofFbo::clearColorBuffer | ( | size_t | buffer_idx, |
const ofFloatColor & | color | ||
) |
glClearBufferfv(GL_COLOR, buffer_idx...)
◆ clearDepthBuffer()
void ofFbo::clearDepthBuffer | ( | float | value | ) |
glClearBufferfv(GL_DEPTH...)
◆ clearDepthStencilBuffer()
void ofFbo::clearDepthStencilBuffer | ( | float | depth, |
int | stencil | ||
) |
glClearBufferfi(GL_DEPTH_STENCIL...)
◆ clearStencilBuffer()
void ofFbo::clearStencilBuffer | ( | int | value | ) |
glClearBufferiv(GL_STENCIL...)
◆ copyTo()
void ofFbo::copyTo | ( | ofBufferObject & | buffer | ) | const |
Copy the fbo to an ofBufferObject.
- Parameters
-
buffer the target buffer to copy to.
◆ createAndAttachDepthStencilTexture() [1/2]
void ofFbo::createAndAttachDepthStencilTexture | ( | GLenum | target, |
GLint | internalformat, | ||
GLenum | attachment | ||
) |
◆ createAndAttachDepthStencilTexture() [2/2]
void ofFbo::createAndAttachDepthStencilTexture | ( | GLenum | target, |
GLint | internalformat, | ||
GLenum | attachment, | ||
GLenum | transferFormat, | ||
GLenum | transferType | ||
) |
◆ createAndAttachRenderbuffer()
GLuint ofFbo::createAndAttachRenderbuffer | ( | GLenum | internalFormat, |
GLenum | attachmentPoint | ||
) |
◆ createAndAttachTexture()
void ofFbo::createAndAttachTexture | ( | GLenum | internalFormat, |
GLenum | attachmentPoint | ||
) |
◆ draw() [1/7]
|
virtual |
Draw at a position at the native size.
Native size is determined by getWidth() and getHeight().
- Parameters
-
point Draw position.
Reimplemented from ofBaseDraws.
◆ draw() [2/7]
|
virtual |
Draw at a position.
- Parameters
-
point Draw position. w Draw width. h Draw height.
Reimplemented from ofBaseDraws.
◆ draw() [3/7]
|
virtual |
Draw at a position and size specified by a rectangle.
- Parameters
-
rect Draw position and size.
Reimplemented from ofBaseDraws.
◆ draw() [4/7]
|
inlinevirtual |
Draw at a position at the native size.
Native size is determined by getWidth() and getHeight().
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis.
Reimplemented from ofBaseDraws.
◆ draw() [5/7]
|
virtual |
Draw at a position at the native size.
Native size is determined by getWidth() and getHeight().
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis.
Reimplemented from ofBaseDraws.
◆ draw() [6/7]
|
virtual |
Draw at a position with the specified size.
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis. w Draw width. h Draw height.
Implements ofBaseDraws.
◆ draw() [7/7]
|
virtual |
Draw at a position with the specified size.
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis. w Draw width. h Draw height.
Implements ofBaseDraws.
◆ end()
void ofFbo::end | ( | ) | const |
Ends the current framebuffer render context.
- See also
- void begin(bool setupScreen=true) const;
◆ flagDirty()
void ofFbo::flagDirty | ( | ) | const |
check whether attached MSAA buffers need updating
◆ getDefaultTextureIndex()
int ofFbo::getDefaultTextureIndex | ( | ) | const |
◆ getDepthBuffer()
|
inline |
◆ getDepthTexture() [1/2]
ofTexture & ofFbo::getDepthTexture | ( | ) |
◆ getDepthTexture() [2/2]
const ofTexture & ofFbo::getDepthTexture | ( | ) | const |
◆ getHeight()
|
virtual |
◆ getId()
GLuint ofFbo::getId | ( | ) | const |
returns id of the underlying GL object for advanced actions
◆ getIdDrawBuffer()
GLuint ofFbo::getIdDrawBuffer | ( | ) | const |
returns id of Fbo for texture attachments which is different when the fbo is using MSAA
◆ getNumTextures()
int ofFbo::getNumTextures | ( | ) | const |
◆ getStencilBuffer()
|
inline |
◆ getTexture() [1/4]
|
virtual |
- Returns
- a reference to the ofTexture.
Implements ofBaseHasTexture.
◆ getTexture() [2/4]
|
virtual |
- Returns
- a const reference to the ofTexture.
Implements ofBaseHasTexture.
◆ getTexture() [3/4]
ofTexture & ofFbo::getTexture | ( | int | attachmentPoint | ) |
◆ getTexture() [4/4]
const ofTexture & ofFbo::getTexture | ( | int | attachmentPoint | ) | const |
◆ getWidth()
|
virtual |
◆ isAllocated()
bool ofFbo::isAllocated | ( | ) | const |
◆ isUsingTexture()
|
inlinevirtual |
- Returns
- true if an internal ofTexture is being used.
Implements ofBaseHasTexture.
◆ maxColorAttachments()
|
static |
◆ maxDrawBuffers()
|
static |
◆ maxSamples()
|
static |
◆ OF_DEPRECATED_MSG() [1/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use begin(OF_FBOMODE_NODEFAULTS) instead" | , |
void begin(bool setupScreen) const | |||
) |
Sets up the framebuffer and binds it for rendering.
- Warning
- This is a convenience method, and is considered unsafe in multi-window and/or multi-renderer scenarios. If you use more than one renderer, use each renderer's explicit void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) method instead.
◆ OF_DEPRECATED_MSG() [2/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use clear() instead" | , |
void | destroy() | ||
) |
◆ OF_DEPRECATED_MSG() [3/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use getId()" | , |
GLuint getFbo() const | |||
) |
◆ OF_DEPRECATED_MSG() [4/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use getTexture()" | , |
const ofTexture &getTextureReference() const | |||
) |
◆ OF_DEPRECATED_MSG() [5/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use getTexture()" | , |
const ofTexture &getTextureReference(int attachmentPoint) const | |||
) |
◆ OF_DEPRECATED_MSG() [6/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use getTexture()" | , |
ofTexture & | getTextureReference() | ||
) |
◆ OF_DEPRECATED_MSG() [7/7]
ofFbo::OF_DEPRECATED_MSG | ( | "Use getTexture()" | , |
ofTexture & | getTextureReferenceint attachmentPoint | ||
) |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ readToPixels() [1/3]
void ofFbo::readToPixels | ( | ofFloatPixels & | pixels, |
int | attachmentPoint = 0 |
||
) | const |
◆ readToPixels() [2/3]
void ofFbo::readToPixels | ( | ofPixels & | pixels, |
int | attachmentPoint = 0 |
||
) | const |
◆ readToPixels() [3/3]
void ofFbo::readToPixels | ( | ofShortPixels & | pixels, |
int | attachmentPoint = 0 |
||
) | const |
◆ resetAnchor()
|
virtual |
Reset the anchor point to (0, 0).
Reimplemented from ofBaseDraws.
◆ setActiveDrawBuffer()
void ofFbo::setActiveDrawBuffer | ( | int | i | ) |
◆ setActiveDrawBuffers()
void ofFbo::setActiveDrawBuffers | ( | const std::vector< int > & | i | ) |
◆ setAnchorPercent()
|
virtual |
Set the anchor point the item is drawn around as a percentage.
This can be useful if you want to rotate an image around a particular point.
- Parameters
-
xPct Horizontal position as a percentage (0 - 1). yPct Vertical position as a percentage (0 - 1).
Reimplemented from ofBaseDraws.
◆ setAnchorPoint()
|
virtual |
Set the anchor point the item is drawn around in pixels.
This can be useful if you want to rotate an image around a particular point.
- Parameters
-
x Horizontal texture position in pixels. y Vertical texture position in pixels.
Reimplemented from ofBaseDraws.
◆ setDefaultTextureIndex()
void ofFbo::setDefaultTextureIndex | ( | int | defaultTexture | ) |
◆ setUseTexture()
|
inlinevirtual |
Enable or disable internal ofTexture use.
- Parameters
-
bUseTex true if an ofTexture should be used.
Implements ofBaseHasTexture.
◆ unbind()
void ofFbo::unbind | ( | ) | const |
◆ updateTexture()
void ofFbo::updateTexture | ( | int | attachmentPoint | ) |
Explicityl resolve MSAA render buffers into textures.
- Note
- if using MSAA, we will have rendered into a colorbuffer, not directly into the texture call this to blit from the colorbuffer into the texture so we can use the results for rendering, or input to a shader etc.
- This will get called implicitly upon getTexture();
The documentation for this class was generated from the following files: