public

Inheritance Graph

graph BT
	FBO
	FBO --> ReferenceCounter
	click FBO "classRendering_1_1FBO"
	click ReferenceCounter "classUtil_1_1ReferenceCounter"

Description

Representation of a frame buffer object ( FBO ).

See also: A good introductionhttp://www.songho.ca/opengl/gl_fbo.html

// create a FBO
Util::Reference<FBO> fbo = new FBO;

// create a color and depthTexures
Util::Reference<Texture> depthTexture = TextureUtils::createDepthTexture(width, height);
Util::Reference<Texture> colorTexture = TextureUtils::createStdTexture(width, height, true);

myRenderingContext.pushFBO(fbo.get());  // enable FBO

// attach textures
fbo->attachColorTexture(colorTexture.get());
fbo->attachDepthTexture(depthTexture.get());

// check framebuffer
if(!fbo->isComplete()){
    WARN( fbo->getStatusMessage() );
    myRenderingContext.popFBO();
    return;
}

myRenderingContext.popFBO();    // disable FBO

//...

myRenderingContext.pushFBO(fbo.get());
// ... do some rendering
myRenderingContext.popFBO();

// download a texture to access the pixel data
colorTexture->downloadGLTexture();

Public Functions

   
   
  FBO()
   
  ~FBO()
   
void _enable()
   
bool isComplete( RenderingContext & context)
   
const char * getStatusMessage( RenderingContext & context)
   
void attachTexture( RenderingContext & context, uint32_t attachmentPoint, Texture * t, uint32_t level, int32_t layer)
   
void detachTexture( RenderingContext & context, uint32_t attachmentPoint)
   
void attachColorTexture( RenderingContext & context, Texture * t, uint32_t colorBufferId, uint32_t level, int32_t layer)
   
void detachColorTexture( RenderingContext & context, uint32_t colorBufferId)
   
void attachDepthStencilTexture( RenderingContext & context, Texture * t, uint32_t level, int32_t layer)
   
void detachDepthStencilTexture( RenderingContext & context)
   
void attachDepthTexture( RenderingContext & context, Texture * t, uint32_t level, int32_t layer)
   
void detachDepthTexture( RenderingContext & context)
   
void setDrawBuffers( RenderingContext & context, uint32_t number)
   
void blitToScreen( RenderingContext & context, const Geometry::Rect_i & srcRect, const Geometry::Rect_i & tgtRect)
copy a block of pixels from this framebuffer to the screen

Public Static Functions

   
   
void _disable()

Documentation

function
Rendering::FBO::FBO

public
   
   
FBO( )

Defined in Rendering/FBO.h:62


function
Rendering::FBO::~FBO

public
   
   
~FBO( )

Defined in Rendering/FBO.h:63


function
Rendering::FBO::_enable

public
   
   
void _enable( )

Note: is called by RenderingContext and should not be called directy

Defined in Rendering/FBO.h:69


function
Rendering::FBO::isComplete

public
     
     
bool isComplete( RenderingContext & context )

Defined in Rendering/FBO.h:71


function
Rendering::FBO::getStatusMessage

public
     
     
const char * getStatusMessage( RenderingContext & context )

Defined in Rendering/FBO.h:73


function
Rendering::FBO::attachTexture

public
     
     
void attachTexture( RenderingContext & context,
  uint32_t attachmentPoint,
  Texture * t,
  uint32_t level,
  int32_t layer
)    

Defined in Rendering/FBO.h:75


function
Rendering::FBO::detachTexture

public inline
     
     
void detachTexture( RenderingContext & context,
  uint32_t attachmentPoint
)    

Defined in Rendering/FBO.h:76


function
Rendering::FBO::attachColorTexture

public
     
     
void attachColorTexture( RenderingContext & context,
  Texture * t,
  uint32_t colorBufferId,
  uint32_t level,
  int32_t layer
)    

Defined in Rendering/FBO.h:78


function
Rendering::FBO::detachColorTexture

public
     
     
void detachColorTexture( RenderingContext & context,
  uint32_t colorBufferId
)    

Defined in Rendering/FBO.h:79


function
Rendering::FBO::attachDepthStencilTexture

public
     
     
void attachDepthStencilTexture( RenderingContext & context,
  Texture * t,
  uint32_t level,
  int32_t layer
)    

Defined in Rendering/FBO.h:80


function
Rendering::FBO::detachDepthStencilTexture

public
     
     
void detachDepthStencilTexture( RenderingContext & context )

Defined in Rendering/FBO.h:81


function
Rendering::FBO::attachDepthTexture

public
     
     
void attachDepthTexture( RenderingContext & context,
  Texture * t,
  uint32_t level,
  int32_t layer
)    

Defined in Rendering/FBO.h:82


function
Rendering::FBO::detachDepthTexture

public
     
     
void detachDepthTexture( RenderingContext & context )

Defined in Rendering/FBO.h:83


function
Rendering::FBO::setDrawBuffers

public
     
     
void setDrawBuffers( RenderingContext & context,
  uint32_t number
)    

Activate the given number of draw buffers.

Parameters

number
Number of draw buffers to activate. Must be from [0, 8].

Exceptions

std::invalid_argument
ifnumberis greater than eight.
std::logic_error
if the GL implementation does not support this functionality.

See also: functionglDrawBuffers

Defined in Rendering/FBO.h:93


function
Rendering::FBO::blitToScreen

public
     
     
void blitToScreen( RenderingContext & context,
  const Geometry::Rect_i & srcRect,
  const Geometry::Rect_i & tgtRect
)    

copy a block of pixels from this framebuffer to the screen

Defined in Rendering/FBO.h:96


function
Rendering::FBO::_disable

public static
   
   
void _disable( )

Note: is called by RenderingContext and should not be called directy

Defined in Rendering/FBO.h:66