Visualization Library 2.0.0
A 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. More... | |
void | createFBO () |
Creates a framebuffer object by calling glGenFramebuffers(). More... | |
void | deleteFBO () |
Deletes a framebuffer object by calling glDeleteFramebuffers(). More... | |
void | setHandle (GLuint handle) |
The handle of the framebuffer object as returned by glGenFramebuffers. More... | |
virtual GLuint | handle () const |
The handle of the framebuffer object as returned by glGenFramebuffers. More... | |
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. More... | |
GLenum | checkFramebufferStatus () |
Checks the framebuffer status and returns the value of glCheckFramebufferStatus() More... | |
void | printFramebufferError (GLenum status) const |
Prints a human readable description of the error code as returned by glCheckFramebufferStatus() More... | |
void | addColorAttachment (EAttachmentPoint attach_point, FBOColorBufferAttachment *attachment) |
Binds a color attachment to a framebuffer object. More... | |
void | addTextureAttachment (EAttachmentPoint attach_point, FBOAbstractTextureAttachment *attachment) |
Binds a texture attachment to a framebuffer object. More... | |
void | addDepthAttachment (FBOAbstractAttachment *attachment) |
Binds a depth attachment to a framebuffer object. More... | |
void | addStencilAttachment (FBOAbstractAttachment *attachment) |
Binds a stencil attachment to a framebuffer object. More... | |
void | addDepthStencilAttachment (FBOAbstractAttachment *attachment) |
Binds a depth-stencil attachment to a framebuffer object. More... | |
void | removeAttachment (FBOAbstractAttachment *attachment) |
Unbinds the given attachments from a framebuffer object. More... | |
void | removeAttachment (EAttachmentPoint attach_point) |
Unbinds the attachment associated to the given attachment point from a framebuffer object. More... | |
void | removeAllAttachments () |
Unbinds all attachments bound to a framebuffer object. More... | |
const std::map< EAttachmentPoint, ref< FBOAbstractAttachment > > & | fboAttachments () const |
A map associating which fbo-attachment belongs to which attachment point in a framebuffer object. More... | |
Public Member Functions inherited from vl::Framebuffer | |
Framebuffer (OpenGLContext *ctx, int w, int h, EReadDrawBuffer draw_buffer, EReadDrawBuffer read_buffer) | |
Constructor, see also OpenGLContext::framebuffer(). More... | |
OpenGLContext * | openglContext () |
The OpenGLContext bound to a render target. More... | |
const OpenGLContext * | openglContext () const |
The OpenGLContext bound to a render target. More... | |
int | width () const |
The width of a render target. More... | |
int | height () const |
The height of a render target. More... | |
void | setWidth (int width) |
The width of a render target. More... | |
void | setHeight (int height) |
The height of a render target. More... | |
void | activate (EFramebufferBind target=FBB_FRAMEBUFFER) |
Activates the Framebuffer by calling bindFramebuffer() and bindDrawBuffers() More... | |
void | bindReadBuffer () |
Binds to the currently active framebuffer object (including the 0 one) the read buffer specified by setReadBuffer(). More... | |
void | bindDrawBuffers () const |
Binds to the currently active framebuffer object (including the 0 one) the draw buffers specified by setDrawBuffers(). More... | |
bool | checkDrawBuffers () const |
Returns true if the draw buffers bound to this render target are legal for this render target type. More... | |
void | setDrawBuffer (EReadDrawBuffer draw_buffer) |
Specifies the color buffer to be drawn into. More... | |
void | setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2) |
Specifies a list of color buffers to be drawn into. More... | |
void | setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3) |
Specifies a list of color buffers to be drawn into. More... | |
void | setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3, EReadDrawBuffer draw_buffer4) |
Specifies a list of color buffers to be drawn into. More... | |
void | setDrawBuffers (const std::vector< EReadDrawBuffer > &draw_buffers) |
Specifies a list of color buffers to be drawn into. More... | |
const std::vector< EReadDrawBuffer > & | drawBuffers () |
The color buffers to be drawn into. More... | |
EReadDrawBuffer | readBuffer () const |
The read-buffer bound when the render target is activated. More... | |
void | setReadBuffer (EReadDrawBuffer read_buffer) |
The read-buffer bound when the render target is activated. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Public Attributes | |
std::map< EAttachmentPoint, ref< FBOAbstractAttachment > > | mFBOAttachments |
GLuint | mHandle |
Friends | |
class | OpenGLContext |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
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.
|
inline |
Destructor.
Definition at line 565 of file FramebufferObject.hpp.
void FramebufferObject::addColorAttachment | ( | EAttachmentPoint | attach_point, |
FBOColorBufferAttachment * | attachment | ||
) |
Binds a color attachment to a framebuffer object.
Definition at line 238 of file FramebufferObject.cpp.
References vl::AP_COLOR_ATTACHMENT0, vl::AP_COLOR_ATTACHMENT15, vl::FBORenderbufferAttachment::bindAttachment(), vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, 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 262 of file FramebufferObject.cpp.
References vl::AP_DEPTH_ATTACHMENT, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, and VL_CHECK.
void FramebufferObject::addDepthStencilAttachment | ( | FBOAbstractAttachment * | attachment | ) |
Binds a depth-stencil attachment to a framebuffer object.
Definition at line 284 of file FramebufferObject.cpp.
References vl::AP_DEPTH_STENCIL_ATTACHMENT, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, 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 273 of file FramebufferObject.cpp.
References vl::AP_STENCIL_ATTACHMENT, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, and VL_CHECK.
void FramebufferObject::addTextureAttachment | ( | EAttachmentPoint | attach_point, |
FBOAbstractTextureAttachment * | attachment | ||
) |
Binds a texture attachment to a framebuffer object.
Definition at line 250 of file FramebufferObject.cpp.
References vl::AP_COLOR_ATTACHMENT0, vl::AP_COLOR_ATTACHMENT15, vl::FBOAbstractAttachment::bindAttachment(), vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, and VL_CHECK.
|
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 101 of file FramebufferObject.cpp.
References vl::Log::error(), vl::FBB_DRAW_FRAMEBUFFER, vl::FBB_FRAMEBUFFER, vl::FBB_READ_FRAMEBUFFER, vl::Has_FBO, VL_CHECK, VL_CHECK_OGL, and VL_TRAP.
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 154 of file FramebufferObject.cpp.
References vl::Log::error(), vl::globalSettings(), vl::Has_FBO, vl::VEL_VERBOSITY_NORMAL, VL_CHECK, and VL_CHECK_OGL.
void FramebufferObject::createFBO | ( | ) |
Creates a framebuffer object by calling glGenFramebuffers().
Definition at line 71 of file FramebufferObject.cpp.
References VL_CHECK, and VL_CHECK_OGL.
void FramebufferObject::deleteFBO | ( | ) |
Deletes a framebuffer object by calling glDeleteFramebuffers().
Definition at line 84 of file FramebufferObject.cpp.
References VL_CHECK, and VL_CHECK_OGL.
|
inline |
A map associating which fbo-attachment belongs to which attachment point in a framebuffer object.
Definition at line 629 of file FramebufferObject.hpp.
|
inlinevirtual |
The handle of the framebuffer object as returned by glGenFramebuffers.
Reimplemented from vl::Framebuffer.
Definition at line 583 of file FramebufferObject.hpp.
References vl::FBB_FRAMEBUFFER.
void FramebufferObject::printFramebufferError | ( | GLenum | status | ) | const |
Prints a human readable description of the error code as returned by glCheckFramebufferStatus()
Definition at line 199 of file FramebufferObject.cpp.
References vl::Log::bug(), and VL_TRAP.
void FramebufferObject::removeAllAttachments | ( | ) |
Unbinds all attachments bound to a framebuffer object.
Definition at line 340 of file FramebufferObject.cpp.
References vl::Has_FBO, and VL_CHECK.
void FramebufferObject::removeAttachment | ( | FBOAbstractAttachment * | attachment | ) |
Unbinds the given attachments from a framebuffer object.
Definition at line 295 of file FramebufferObject.cpp.
References vl::Has_FBO, and VL_CHECK.
void FramebufferObject::removeAttachment | ( | EAttachmentPoint | attach_point | ) |
Unbinds the attachment associated to the given attachment point from a framebuffer object.
Definition at line 312 of file FramebufferObject.cpp.
References vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, VL_CHECK, and VL_CHECK_OGL.
|
inline |
The handle of the framebuffer object as returned by glGenFramebuffers.
Definition at line 580 of file FramebufferObject.hpp.
|
friend |
Definition at line 542 of file FramebufferObject.hpp.
std::map< EAttachmentPoint, ref<FBOAbstractAttachment> > vl::FramebufferObject::mFBOAttachments |
Definition at line 632 of file FramebufferObject.hpp.
GLuint vl::FramebufferObject::mHandle |
Definition at line 633 of file FramebufferObject.hpp.
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:08.
© Copyright Michele Bosi. All rights reserved.