12#ifndef FRAMEBUFFER_H_6014714286
13#define FRAMEBUFFER_H_6014714286
19#include <Carna/Carna.h>
61 const static unsigned int MAXIMUM_ALLOWED_COLOR_COMPONENTS = 8;
97 const unsigned int id;
130 void resize(
unsigned int width,
unsigned int height );
203 Color readPixel(
unsigned int x,
unsigned int y,
unsigned int location = 0 )
const;
224 void bindFBO()
const;
271 Texture< 2 >* renderTextures[ MAXIMUM_ALLOWED_COLOR_COMPONENTS ];
272 const unsigned int depthBuffer;
273 std::set< unsigned int > boundColorBuffers;
286 ,
unsigned int srcWidth,
unsigned int srcHeight
303#define CARNA_RENDER_TO_FRAMEBUFFER_EX( fbo, binding, instructions ) \
305 Carna::base::Framebuffer::Binding binding( fbo ); \
317#define CARNA_RENDER_TO_FRAMEBUFFER( fbo, instructions ) \
318 CARNA_RENDER_TO_FRAMEBUFFER_EX( fbo, fboBinding##__COUNTER__, instructions )
Represents an association.
Represents a color. Objects from this class are copyable and assignable.
Acts like MinimalBinding, but checks the bound framebuffer for validity and allows rendering.
Binding(Framebuffer &)
Binds fbo as the current framebuffer.
virtual void refresh()
Re-performs the binding.
Maintains the binding of a Framebuffer in a RAII-manner.
virtual void refresh() const
Re-performs this binding. This is useful if the currently bound framebuffer has been changed through ...
virtual ~MinimalBinding()
Retracts this binding and restores the previous one.
const Framebuffer & framebuffer() const
References the bound framebuffer.
void removeColorComponent(unsigned int location)
Removes color component at location from bound framebuffer object.
MinimalBinding(Framebuffer &fbo)
Binds fbo as the current framebuffer.
void setColorComponent(Texture< 2 > &renderTexture, unsigned int location=0)
Attaches renderTexture as the color component at location of the bound framebuffer object.
Color readPixel(unsigned int x, unsigned int y, unsigned int location=0) const
Reads the color of the pixel located at x and y within the color attachment at location.
Framebuffer & fbo
References the bound framebuffer.
Maintains a framebuffer object that supports up to 8 color components simultaneously.
unsigned int width() const
Returns the framebuffer's width.
void resize(const math::Vector2ui &size)
Resizes depth buffer and color components to size.
void resize(unsigned int width, unsigned int height)
const unsigned int id
Identifies the maintained framebuffer object.
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 th...
bool hasRenderTexture(unsigned int location) const
Tells whether a color component exists at location.
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 ...
const Texture< 2 > & renderTexture(unsigned int location) const
References the render texture at location.
Framebuffer(unsigned int width, unsigned int height, Texture< 2 > &renderTexture)
Acquires framebuffer object with depth buffer and attaches renderTexture as the first color attachmen...
static Texture< 2 > * createRenderTexture(bool floatingPoint=false)
Creates render texture.
unsigned int height() const
Returns the framebuffer's height.
static unsigned int currentId()
Tells the ID of the currently bound framebuffer. This is 0 for the main framebuffer.
~Framebuffer()
Deletes the maintained framebuffer object and its depth buffer.
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Eigen::Matrix< unsigned int, 2, 1 > Vector2ui
Defines vector.
#define NON_COPYABLE
Features class it is placed in as non-copyable.