Carna  Version 3.0.1
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Carna::base::Framebuffer Class Reference

Maintains a framebuffer object that supports up to 8 color components simultaneously. More...

#include <Framebuffer.h>

Classes

class  Binding
 Acts like MinimalBinding, but checks the bound framebuffer for validity and allows rendering. More...
 
class  MinimalBinding
 Maintains the binding of a Framebuffer in a RAII-manner. More...
 

Public Member Functions

 Framebuffer (unsigned int width, unsigned int height, Texture< 2 > &renderTexture)
 Acquires framebuffer object with depth buffer and attaches renderTexture as the first color attachment. The renderTexture is resized automatically s.t. it matches the size of the framebuffer.
 
 ~Framebuffer ()
 Deletes the maintained framebuffer object and its depth buffer.
 
bool hasRenderTexture (unsigned int location) const
 Tells whether a color component exists at location.
 
const Texture< 2 > & renderTexture (unsigned int location) const
 References the render texture at location. More...
 
void resize (const math::Vector2ui &size)
 Resizes depth buffer and color components to size.
 
void resize (unsigned int width, unsigned int height)
 
unsigned int width () const
 Returns the framebuffer's width.
 
unsigned int height () const
 Returns the framebuffer's height.
 

Static Public Member Functions

static Texture< 2 > * createRenderTexture (bool floatingPoint=false)
 Creates render texture. More...
 
static void copyDepthAttachment (unsigned int srcId, unsigned int dstId, const Viewport &src, const Viewport &dst)
 Copies data from the depth attachment of the framebuffer identified by srcId to the depth attachment of the framebuffer identified by dstId. Use 0 for one of these arguments to reference the main framebuffer.
 
static void copyColorAttachment (unsigned int srcId, unsigned int dstId, const Viewport &src, const Viewport &dst, unsigned int srcColorAttachment, unsigned int dstColorAttachment)
 Copies data from the color attachment srcColorAttachment of the framebuffer identified by srcId to the color attachment dstColorAttachment of the framebuffer identified by dstId. Use 0 for one of these arguments to reference the main framebuffer.
 
static unsigned int currentId ()
 Tells the ID of the currently bound framebuffer. This is 0 for the main framebuffer.
 

Public Attributes

const unsigned int id
 Identifies the maintained framebuffer object.
 

Static Public Attributes

static const unsigned int MAXIMUM_ALLOWED_COLOR_COMPONENTS = 8
 Holds maximum number of simultaneously supported color attachments.
 

Detailed Description

Maintains a framebuffer object that supports up to 8 color components simultaneously.

An OpenGL framebuffer object typically consists of a depth attachment and an ordered set of color attachments. The depth attachment can be realized either by a depth buffer (faster, read-only) or by a depth texture. Color attachments are always textures. We call them render textures here.

Author
Leonid Kostrykin
Date
9.3.2011 - 25.3.15

Definition at line 49 of file Framebuffer.h.

Member Function Documentation

static Texture< 2 >* Carna::base::Framebuffer::createRenderTexture ( bool  floatingPoint = false)
static

Creates render texture.

Parameters
floatingPointsets whether float-based pixels shall be used instead of unsigned byte.
const Texture< 2 >& Carna::base::Framebuffer::renderTexture ( unsigned int  location) const

References the render texture at location.

Precondition
hasRenderTexture(location) == true
void Carna::base::Framebuffer::resize ( unsigned int  width,
unsigned int  height 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


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