reference

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>

Inheritance diagram for ofFbo:
ofBaseDraws ofBaseHasTexture

Public Types

typedef ofFboSettings Settings
 ofFbo::Settings is currently deprecated in favor of the ofFboSettings struct
 

Public Member Functions

 ofFbo ()
 
 ofFbo (const ofFbo &mom)
 
ofFbooperator= (const ofFbo &fbo)
 
 ofFbo (ofFbo &&mom)
 
ofFbooperator= (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))
 
ofTexturegetTexture ()
 
ofTexturegetTexture (int attachmentPoint)
 
ofTexturegetDepthTexture ()
 
 OF_DEPRECATED_MSG ("Use getTexture()", const ofTexture &getTextureReference() const)
 
 OF_DEPRECATED_MSG ("Use getTexture()", const ofTexture &getTextureReference(int attachmentPoint) const)
 
const ofTexturegetTexture () const
 
const ofTexturegetTexture (int attachmentPoint) const
 
const ofTexturegetDepthTexture () 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.
 
- Public Member Functions inherited from ofBaseDraws
virtual ~ofBaseDraws ()
 Destroy the abstract object.
 
- Public Member Functions inherited from ofBaseHasTexture
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

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()

ofFbo::~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.
See also
void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode)

◆ 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()

bool ofFbo::checkGLSupport ( )
static

◆ checkStatus()

bool ofFbo::checkStatus ( ) const

◆ clear()

void ofFbo::clear ( )

◆ clearColorBuffer() [1/2]

void ofFbo::clearColorBuffer ( const ofFloatColor color)

glClearBufferfv(GL_COLOR, 0...)

See also
: https://www.opengl.org/wiki/GLAPI/glClearBuffer

◆ clearColorBuffer() [2/2]

void ofFbo::clearColorBuffer ( size_t  buffer_idx,
const ofFloatColor color 
)

glClearBufferfv(GL_COLOR, buffer_idx...)

See also
: https://www.opengl.org/wiki/GLAPI/glClearBuffer

◆ clearDepthBuffer()

void ofFbo::clearDepthBuffer ( float  value)

glClearBufferfv(GL_DEPTH...)

See also
: https://www.opengl.org/wiki/GLAPI/glClearBuffer

◆ clearDepthStencilBuffer()

void ofFbo::clearDepthStencilBuffer ( float  depth,
int  stencil 
)

glClearBufferfi(GL_DEPTH_STENCIL...)

See also
: https://www.opengl.org/wiki/GLAPI/glClearBuffer

◆ clearStencilBuffer()

void ofFbo::clearStencilBuffer ( int  value)

glClearBufferiv(GL_STENCIL...)

See also
: https://www.opengl.org/wiki/GLAPI/glClearBuffer

◆ copyTo()

void ofFbo::copyTo ( ofBufferObject buffer) const

Copy the fbo to an ofBufferObject.

Parameters
bufferthe 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]

void ofBaseDraws::draw ( const glm::vec2 &  point) const
virtual

Draw at a position at the native size.

Native size is determined by getWidth() and getHeight().

Parameters
pointDraw position.

Reimplemented from ofBaseDraws.

◆ draw() [2/7]

void ofBaseDraws::draw ( const glm::vec2 &  point,
float  w,
float  h 
) const
virtual

Draw at a position.

Parameters
pointDraw position.
wDraw width.
hDraw height.

Reimplemented from ofBaseDraws.

◆ draw() [3/7]

void ofBaseDraws::draw ( const ofRectangle rect) const
virtual

Draw at a position and size specified by a rectangle.

Parameters
rectDraw position and size.

Reimplemented from ofBaseDraws.

◆ draw() [4/7]

virtual void ofBaseDraws::draw ( float  x,
float  y 
) const
inlinevirtual

Draw at a position at the native size.

Native size is determined by getWidth() and getHeight().

Parameters
xDraw position on the x axis.
yDraw position on the y axis.

Reimplemented from ofBaseDraws.

◆ draw() [5/7]

void ofFbo::draw ( float  x,
float  y 
) const
virtual

Draw at a position at the native size.

Native size is determined by getWidth() and getHeight().

Parameters
xDraw position on the x axis.
yDraw position on the y axis.

Reimplemented from ofBaseDraws.

◆ draw() [6/7]

virtual void ofBaseDraws::draw ( float  x,
float  y,
float  w,
float  h 
) const
virtual

Draw at a position with the specified size.

Parameters
xDraw position on the x axis.
yDraw position on the y axis.
wDraw width.
hDraw height.

Implements ofBaseDraws.

◆ draw() [7/7]

void ofFbo::draw ( float  x,
float  y,
float  w,
float  h 
) const
virtual

Draw at a position with the specified size.

Parameters
xDraw position on the x axis.
yDraw position on the y axis.
wDraw width.
hDraw 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()

GLuint ofFbo::getDepthBuffer ( ) const
inline

◆ getDepthTexture() [1/2]

ofTexture & ofFbo::getDepthTexture ( )

◆ getDepthTexture() [2/2]

const ofTexture & ofFbo::getDepthTexture ( ) const

◆ getHeight()

float ofFbo::getHeight ( ) const
virtual

Get the height.

Returns
the height.

Implements ofBaseDraws.

◆ 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()

GLuint ofFbo::getStencilBuffer ( ) const
inline

◆ getTexture() [1/4]

ofTexture & ofFbo::getTexture ( )
virtual
Returns
a reference to the ofTexture.

Implements ofBaseHasTexture.

◆ getTexture() [2/4]

const ofTexture & ofFbo::getTexture ( ) const
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()

float ofFbo::getWidth ( ) const
virtual

Get the width.

Returns
the width.

Implements ofBaseDraws.

◆ isAllocated()

bool ofFbo::isAllocated ( ) const

◆ isUsingTexture()

bool ofFbo::isUsingTexture ( ) const
inlinevirtual
Returns
true if an internal ofTexture is being used.

Implements ofBaseHasTexture.

◆ maxColorAttachments()

int ofFbo::maxColorAttachments ( )
static

◆ maxDrawBuffers()

int ofFbo::maxDrawBuffers ( )
static

◆ maxSamples()

int ofFbo::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.
See also
void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode)

◆ 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]

ofFbo & ofFbo::operator= ( const ofFbo fbo)

◆ operator=() [2/2]

ofFbo & ofFbo::operator= ( ofFbo &&  fbo)

◆ 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()

void ofFbo::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()

void ofFbo::setAnchorPercent ( float  xPct,
float  yPct 
)
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
xPctHorizontal position as a percentage (0 - 1).
yPctVertical position as a percentage (0 - 1).

Reimplemented from ofBaseDraws.

◆ setAnchorPoint()

void ofFbo::setAnchorPoint ( float  x,
float  y 
)
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
xHorizontal texture position in pixels.
yVertical texture position in pixels.

Reimplemented from ofBaseDraws.

◆ setDefaultTextureIndex()

void ofFbo::setDefaultTextureIndex ( int  defaultTexture)

◆ setUseTexture()

void ofFbo::setUseTexture ( bool  bUseTex)
inlinevirtual

Enable or disable internal ofTexture use.

Parameters
bUseTextrue if an ofTexture should be used.

Implements ofBaseHasTexture.

◆ unbind()

void ofFbo::unbind ( ) const

Unbinds OpenGL framebuffer target and restores the OpenGL framebuffer render target to whatever this ofFbo stores in previousFramebufferBinding.

See also
bind()
void setPreviousFramebufferBinding(const GLuint& previousFramebufferBinding_) 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:
  • /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/gl/ofFbo.h
  • /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/gl/ofFbo.cpp