Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Implements a framebuffer object to be used as a rendering target as specified by the ARB_framebuffer_object
extension.
More...
#include <FramebufferObject.hpp>
Public Member Functions | |
~FramebufferObject () | |
Destructor. | |
void | createFBO () |
Creates a framebuffer object by calling glGenFramebuffers(). | |
void | deleteFBO () |
Deletes a framebuffer object by calling glDeleteFramebuffers(). | |
void | setHandle (GLuint handle) |
The handle of the framebuffer object as returned by glGenFramebuffers. | |
virtual GLuint | handle () const |
The handle of the framebuffer object as returned by glGenFramebuffers. | |
virtual void | bindFramebuffer (EFramebufferBind target=FBB_FRAMEBUFFER) |
Makes the framebuffer the current rendering target calling glBindFramebuffer( GL_FRAMEBUFFER, FramebufferObject::handle() ) and initializes all the previously defined attachment points. | |
GLenum | checkFramebufferStatus () |
Checks the framebuffer status and returns the value of glCheckFramebufferStatus() | |
void | printFramebufferError (GLenum status) const |
Prints a human readable description of the error code as returned by glCheckFramebufferStatus() | |
void | addColorAttachment (EAttachmentPoint attach_point, FBOColorBufferAttachment *attachment) |
Binds a color attachment to a framebuffer object. | |
void | addTextureAttachment (EAttachmentPoint attach_point, FBOAbstractTextureAttachment *attachment) |
Binds a texture attachment to a framebuffer object. | |
void | addDepthAttachment (FBOAbstractAttachment *attachment) |
Binds a depth attachment to a framebuffer object. | |
void | addStencilAttachment (FBOAbstractAttachment *attachment) |
Binds a stencil attachment to a framebuffer object. | |
void | addDepthStencilAttachment (FBOAbstractAttachment *attachment) |
Binds a depth-stencil attachment to a framebuffer object. | |
void | removeAttachment (FBOAbstractAttachment *attachment) |
Unbinds the given attachments from a framebuffer object. | |
void | removeAttachment (EAttachmentPoint attach_point) |
Unbinds the attachment associated to the given attachment point from a framebuffer object. | |
void | removeAllAttachments () |
Unbinds all attachments bound to a framebuffer object. | |
const std::map < EAttachmentPoint, ref < FBOAbstractAttachment > > & | fboAttachments () const |
A map associating which fbo-attachment belongs to which attachment point in a framebuffer object. | |
Public Attributes | |
std::map< EAttachmentPoint, ref< FBOAbstractAttachment > > | mFBOAttachments |
GLuint | mHandle |
Friends | |
class | OpenGLContext |
Implements a framebuffer object to be used as a rendering target as specified by the ARB_framebuffer_object
extension.
An FramebufferObject belongs to one and only one OpenGLContext and can be created using the OpenGLContext::createFramebufferObject() method. To render to a FramebufferObject use the Rendering::setFramebuffer() function.
ARB_framebuffer_object
specifications http://www.opengl.org/registry/specs/ARB/framebuffer_object.txtDefinition at line 538 of file FramebufferObject.hpp.
vl::FramebufferObject::~FramebufferObject | ( | ) | [inline] |
Destructor.
Definition at line 565 of file FramebufferObject.hpp.
void FramebufferObject::createFBO | ( | ) |
Creates a framebuffer object by calling glGenFramebuffers().
Definition at line 72 of file FramebufferObject.cpp.
References vl::OpenGLContext::makeCurrent(), mHandle, vl::Framebuffer::openglContext(), VL_CHECK, and VL_CHECK_OGL.
void FramebufferObject::deleteFBO | ( | ) |
Deletes a framebuffer object by calling glDeleteFramebuffers().
Definition at line 85 of file FramebufferObject.cpp.
References handle(), vl::OpenGLContext::makeCurrent(), mHandle, vl::Framebuffer::openglContext(), removeAllAttachments(), vl::Framebuffer::setHeight(), vl::Framebuffer::setWidth(), VL_CHECK, and VL_CHECK_OGL.
void vl::FramebufferObject::setHandle | ( | GLuint | handle ) | [inline] |
The handle of the framebuffer object as returned by glGenFramebuffers.
Definition at line 580 of file FramebufferObject.hpp.
virtual GLuint vl::FramebufferObject::handle | ( | ) | const [inline, virtual] |
The handle of the framebuffer object as returned by glGenFramebuffers.
Reimplemented from vl::Framebuffer.
Definition at line 583 of file FramebufferObject.hpp.
Referenced by bindFramebuffer(), checkFramebufferStatus(), deleteFBO(), and removeAttachment().
void FramebufferObject::bindFramebuffer | ( | EFramebufferBind | target = FBB_FRAMEBUFFER ) |
[virtual] |
Makes the framebuffer the current rendering target calling glBindFramebuffer( GL_FRAMEBUFFER, FramebufferObject::handle() ) and initializes all the previously defined attachment points.
Reimplemented from vl::Framebuffer.
Definition at line 102 of file FramebufferObject.cpp.
References vl::Framebuffer::bindDrawBuffers(), vl::Framebuffer::bindReadBuffer(), vl::Log::error(), vl::FBB_DRAW_FRAMEBUFFER, vl::FBB_FRAMEBUFFER, vl::FBB_READ_FRAMEBUFFER, handle(), vl::Has_FBO, vl::Framebuffer::height(), vl::OpenGLContext::makeCurrent(), mFBOAttachments, vl::Framebuffer::openglContext(), printFramebufferError(), VL_CHECK, VL_CHECK_OGL, VL_TRAP, and vl::Framebuffer::width().
GLenum FramebufferObject::checkFramebufferStatus | ( | ) |
Checks the framebuffer status and returns the value of glCheckFramebufferStatus()
Returns 0 if no FBO support is found otherwise returns the value obtained by VL_glCheckFramebufferStatus()
Definition at line 155 of file FramebufferObject.cpp.
References vl::Log::error(), vl::globalSettings(), handle(), vl::Has_FBO, vl::Framebuffer::height(), vl::OpenGLContext::makeCurrent(), mFBOAttachments, vl::Framebuffer::openglContext(), printFramebufferError(), vl::VEL_VERBOSITY_NORMAL, VL_CHECK, VL_CHECK_OGL, and vl::Framebuffer::width().
void FramebufferObject::printFramebufferError | ( | GLenum | status ) | const |
Prints a human readable description of the error code as returned by glCheckFramebufferStatus()
Definition at line 200 of file FramebufferObject.cpp.
References vl::Log::bug(), and VL_TRAP.
Referenced by bindFramebuffer(), and checkFramebufferStatus().
void FramebufferObject::addColorAttachment | ( | EAttachmentPoint | attach_point, |
FBOColorBufferAttachment * | attachment | ||
) |
Binds a color attachment to a framebuffer object.
Definition at line 239 of file FramebufferObject.cpp.
References vl::AP_COLOR_ATTACHMENT0, vl::AP_COLOR_ATTACHMENT15, vl::FBORenderbufferAttachment::bindAttachment(), vl::Has_FBO, mFBOAttachments, vl::FBOAbstractAttachment::mFramebufferObjects, removeAttachment(), and VL_CHECK.
void FramebufferObject::addTextureAttachment | ( | EAttachmentPoint | attach_point, |
FBOAbstractTextureAttachment * | attachment | ||
) |
Binds a texture attachment to a framebuffer object.
Definition at line 251 of file FramebufferObject.cpp.
References vl::AP_COLOR_ATTACHMENT0, vl::AP_COLOR_ATTACHMENT15, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, mFBOAttachments, vl::FBOAbstractAttachment::mFramebufferObjects, removeAttachment(), and VL_CHECK.
void FramebufferObject::addDepthAttachment | ( | FBOAbstractAttachment * | attachment ) |
Binds a depth attachment to a framebuffer object.
The attachment
parameter must point to either a FBODepthBufferAttachment or FBODepthStencilBufferAttachment.
Definition at line 263 of file FramebufferObject.cpp.
References vl::AP_DEPTH_ATTACHMENT, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, mFBOAttachments, vl::FBOAbstractAttachment::mFramebufferObjects, removeAttachment(), and VL_CHECK.
void FramebufferObject::addStencilAttachment | ( | FBOAbstractAttachment * | attachment ) |
Binds a stencil attachment to a framebuffer object.
The attachment
parameter must point to either a FBOStencilBufferAttachment or FBODepthStencilBufferAttachment.
Definition at line 274 of file FramebufferObject.cpp.
References vl::AP_STENCIL_ATTACHMENT, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, mFBOAttachments, vl::FBOAbstractAttachment::mFramebufferObjects, removeAttachment(), and VL_CHECK.
void FramebufferObject::addDepthStencilAttachment | ( | FBOAbstractAttachment * | attachment ) |
Binds a depth-stencil attachment to a framebuffer object.
Definition at line 285 of file FramebufferObject.cpp.
References vl::AP_DEPTH_STENCIL_ATTACHMENT, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, mFBOAttachments, vl::FBOAbstractAttachment::mFramebufferObjects, removeAttachment(), and VL_CHECK.
void FramebufferObject::removeAttachment | ( | FBOAbstractAttachment * | attachment ) |
Unbinds the given attachments from a framebuffer object.
Definition at line 296 of file FramebufferObject.cpp.
References vl::Has_FBO, mFBOAttachments, and VL_CHECK.
Referenced by addColorAttachment(), addDepthAttachment(), addDepthStencilAttachment(), addStencilAttachment(), addTextureAttachment(), and removeAllAttachments().
void FramebufferObject::removeAttachment | ( | EAttachmentPoint | attach_point ) |
Unbinds the attachment associated to the given attachment point from a framebuffer object.
Definition at line 313 of file FramebufferObject.cpp.
References handle(), vl::Has_FBO, vl::VisualizationLibrary::isGraphicsInitialized(), vl::OpenGLContext::makeCurrent(), mFBOAttachments, vl::FBOAbstractAttachment::mFramebufferObjects, vl::Framebuffer::openglContext(), VL_CHECK, and VL_CHECK_OGL.
void FramebufferObject::removeAllAttachments | ( | ) |
Unbinds all attachments bound to a framebuffer object.
Definition at line 343 of file FramebufferObject.cpp.
References vl::Has_FBO, mFBOAttachments, removeAttachment(), and VL_CHECK.
Referenced by deleteFBO().
const std::map< EAttachmentPoint, ref<FBOAbstractAttachment> >& vl::FramebufferObject::fboAttachments | ( | ) | const [inline] |
A map associating which fbo-attachment belongs to which attachment point in a framebuffer object.
Definition at line 629 of file FramebufferObject.hpp.
friend class OpenGLContext [friend] |
Reimplemented from vl::Framebuffer.
Definition at line 542 of file FramebufferObject.hpp.
Definition at line 632 of file FramebufferObject.hpp.
Referenced by addColorAttachment(), addDepthAttachment(), addDepthStencilAttachment(), addStencilAttachment(), addTextureAttachment(), bindFramebuffer(), checkFramebufferStatus(), removeAllAttachments(), and removeAttachment().
Definition at line 633 of file FramebufferObject.hpp.
Referenced by createFBO(), and deleteFBO().