15#ifndef FRAMEBUFFER_H_6014714286
16#define FRAMEBUFFER_H_6014714286
64 const static unsigned int MAXIMUM_ALLOWED_COLOR_COMPONENTS = 8;
100 const unsigned int id;
133 void resize(
unsigned int width,
unsigned int height );
205 Color readPixel(
unsigned int x,
unsigned int y,
unsigned int location = 0 )
const;
226 void bindFBO()
const;
272 Texture< 2 >* renderTextures[ MAXIMUM_ALLOWED_COLOR_COMPONENTS ];
273 const unsigned int depthBuffer;
274 std::set< unsigned int > boundColorBuffers;
304#define LIBCARNA_RENDER_TO_FRAMEBUFFER_EX( fbo, binding, instructions ) \
306 LibCarna::base::Framebuffer::Binding binding( fbo ); \
318#define LIBCARNA_RENDER_TO_FRAMEBUFFER( fbo, instructions ) \
319 LIBCARNA_RENDER_TO_FRAMEBUFFER_EX( fbo, fboBinding##__COUNTER__, instructions )
Contains forward-declarations.
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.
MinimalBinding(Framebuffer &fbo)
Binds fbo as the current framebuffer.
void removeColorComponent(unsigned int location)
Removes color component at location from bound framebuffer object.
virtual ~MinimalBinding()
Retracts this binding and restores the previous one.
const Framebuffer & framebuffer() const
References the bound framebuffer.
Framebuffer & fbo
References the bound framebuffer.
virtual void refresh() const
Re-performs this binding. This is useful if the currently bound framebuffer has been changed through ...
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.
Maintains a framebuffer object that supports up to 8 color components simultaneously.
unsigned int width() const
Returns the framebuffer's width.
const Texture< 2 > & renderTexture(unsigned int location) const
References the render texture at location.
~Framebuffer()
Deletes the maintained framebuffer object and its depth buffer.
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 ...
static Texture< 2 > * createRenderTexture(bool floatingPoint=false)
Creates render texture.
void resize(unsigned int width, unsigned int height)
unsigned int height() const
Returns the framebuffer's height.
const unsigned int id
Identifies the maintained framebuffer object.
Framebuffer(unsigned int width, unsigned int height, Texture< 2 > &renderTexture)
Acquires framebuffer object with depth buffer and attaches renderTexture as the first color attachmen...
void resize(const math::Vector2ui &size)
Resizes depth buffer and color components to size.
bool hasRenderTexture(unsigned int location) const
Tells whether a color component exists at location.
static unsigned int currentId()
Tells the ID of the currently bound framebuffer. This is 0 for 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 th...
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Defines LibCarna::base::math namespace and LIBCARNA_FOR_VECTOR3UI.
Eigen::Matrix< unsigned int, 2, 1 > Vector2ui
Defines vector.
Defines LibCarna::base::noncopyable and NON_COPYABLE.
#define NON_COPYABLE
Marks the class that it is placed in as non-copyable.