|
Visualization Library 2.1.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>
Inheritance diagram for vl::FramebufferObject:Public Member Functions | |
| ~FramebufferObject () | |
| Destructor. 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 FramebufferObject 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... | |
| 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... | |
| bool | externallyManaged () const |
| Wen externallyManaged() == true then this function does nothing. More... | |
| void | setExternallyManaged (bool em) |
| Wen externallyManaged() == true then this function does nothing. 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::vector< EReadDrawBuffer > | mDrawBuffers |
| EReadDrawBuffer | mReadBuffer |
| OpenGLContext * | mOpenGLContext |
| int | mWidth |
| int | mHeight |
| std::map< EAttachmentPoint, ref< FBOAbstractAttachment > > | mFBOAttachments |
| GLuint | mHandle |
| bool | mExternallyManaged |
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 544 of file FramebufferObject.hpp.
|
inline |
Destructor.
Definition at line 595 of file FramebufferObject.hpp.
|
inline |
Activates the FramebufferObject by calling bindFramebuffer() and bindDrawBuffers()
Definition at line 616 of file FramebufferObject.hpp.
Referenced by vl::BlitFramebuffer::copyPixels(), vl::Renderer::render(), and vl::EdgeRenderer::render().
| void FramebufferObject::addColorAttachment | ( | EAttachmentPoint | attach_point, |
| FBOColorBufferAttachment * | attachment | ||
| ) |
Binds a color attachment to a framebuffer object.
Definition at line 376 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 400 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 422 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 411 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 388 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.
| void FramebufferObject::bindDrawBuffers | ( | ) | const |
Binds to the currently active framebuffer object (including the 0 one) the draw buffers specified by setDrawBuffers().
Definition at line 158 of file FramebufferObject.cpp.
References vl::Log::error(), vl::Has_GL_Version_2_0, VL_CHECK, and VL_CHECK_OGL.
|
virtual |
Makes the framebuffer the current rendering target calling glBindFramebuffer( GL_FRAMEBUFFER, FramebufferObject::handle() ) and initializes all the previously defined attachment points.
Wen externallyManaged() == true then this function does nothing. This is used when external logic is handling the framebuffer for example for compositing and off-screen rendering (eg Qt 6 QOpenGLWidget).
Definition at line 225 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.
| void FramebufferObject::bindReadBuffer | ( | ) |
Binds to the currently active framebuffer object (including the 0 one) the read buffer specified by setReadBuffer().
Definition at line 186 of file FramebufferObject.cpp.
References VL_CHECK_OGL.
| bool FramebufferObject::checkDrawBuffers | ( | ) | const |
Returns true if the draw buffers bound to this render target are legal for this render target type.
Definition at line 71 of file FramebufferObject.cpp.
References vl::Log::error().
| 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 292 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 195 of file FramebufferObject.cpp.
References VL_CHECK, and VL_CHECK_OGL.
| void FramebufferObject::deleteFBO | ( | ) |
Deletes a framebuffer object by calling glDeleteFramebuffers().
Definition at line 208 of file FramebufferObject.cpp.
References VL_CHECK, and VL_CHECK_OGL.
|
inline |
The color buffers to be drawn into.
Definition at line 665 of file FramebufferObject.hpp.
|
inline |
Wen externallyManaged() == true then this function does nothing.
This is used when external logic is handling the framebuffer for example for compositing and off-screen rendering (eg Qt 6 QOpenGLWidget).
Definition at line 747 of file FramebufferObject.hpp.
|
inline |
A map associating which fbo-attachment belongs to which attachment point in a framebuffer object.
Definition at line 743 of file FramebufferObject.hpp.
|
inlinevirtual |
The handle of the framebuffer object as returned by glGenFramebuffers.
Definition at line 691 of file FramebufferObject.hpp.
References vl::FBB_FRAMEBUFFER.
|
inline |
The height of a render target.
Definition at line 607 of file FramebufferObject.hpp.
Referenced by vl::FBORenderbufferAttachment::bindAttachment(), vl::FBOTexture2DAttachment::bindAttachment(), vl::FBOTexture3DAttachment::bindAttachment(), vl::FBOTextureLayerAttachment::bindAttachment(), vl::GhostCameraManipulator::enableEvent(), vl::TrackballManipulator::mouseDownEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), vl::TrackballManipulator::mouseMoveEvent(), and vl::Applet::resizeEvent().
|
inline |
The OpenGLContext bound to a render target.
Definition at line 598 of file FramebufferObject.hpp.
Referenced by vl::Renderer::render(), vl::EdgeRenderer::render(), vl::OcclusionCullRenderer::render_pass2(), vl::EdgeRenderer::renderLines(), vl::Renderer::renderRaw(), and vl::EdgeRenderer::renderSolids().
|
inline |
The OpenGLContext bound to a render target.
Definition at line 601 of file FramebufferObject.hpp.
| void FramebufferObject::printFramebufferError | ( | GLenum | status | ) | const |
Prints a human readable description of the error code as returned by glCheckFramebufferStatus()
Definition at line 337 of file FramebufferObject.cpp.
References vl::Log::bug(), and VL_TRAP.
|
inline |
The read-buffer bound when the render target is activated.
Definition at line 668 of file FramebufferObject.hpp.
| void FramebufferObject::removeAllAttachments | ( | ) |
Unbinds all attachments bound to a framebuffer object.
Definition at line 478 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 433 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 450 of file FramebufferObject.cpp.
References vl::Has_FBO, vl::FBOAbstractAttachment::mFramebufferObjects, VL_CHECK, and VL_CHECK_OGL.
|
inline |
Specifies the color buffer to be drawn into.
Definition at line 628 of file FramebufferObject.hpp.
|
inline |
Specifies a list of color buffers to be drawn into.
Definition at line 635 of file FramebufferObject.hpp.
|
inline |
Specifies a list of color buffers to be drawn into.
Definition at line 643 of file FramebufferObject.hpp.
|
inline |
Specifies a list of color buffers to be drawn into.
Definition at line 652 of file FramebufferObject.hpp.
|
inline |
Specifies a list of color buffers to be drawn into.
Definition at line 662 of file FramebufferObject.hpp.
|
inline |
Wen externallyManaged() == true then this function does nothing.
This is used when external logic is handling the framebuffer for example for compositing and off-screen rendering (eg Qt 6 QOpenGLWidget).
Definition at line 750 of file FramebufferObject.hpp.
Referenced by vlQt6::Qt6Widget::initializeGL().
|
inline |
The handle of the framebuffer object as returned by glGenFramebuffers.
Definition at line 688 of file FramebufferObject.hpp.
|
inline |
The height of a render target.
Definition at line 613 of file FramebufferObject.hpp.
Referenced by vlGLUT::GLUTWindow::glut_reshape_func(), vlWin32::Win32Window::WindowProc(), and vlEGL::EGLWindow::WindowProc().
|
inline |
The read-buffer bound when the render target is activated.
Definition at line 671 of file FramebufferObject.hpp.
|
inline |
The width of a render target.
Definition at line 610 of file FramebufferObject.hpp.
Referenced by vlGLUT::GLUTWindow::glut_reshape_func(), vlWin32::Win32Window::WindowProc(), and vlEGL::EGLWindow::WindowProc().
|
inline |
The width of a render target.
Definition at line 604 of file FramebufferObject.hpp.
Referenced by vl::FBORenderbufferAttachment::bindAttachment(), vl::FBOTexture1DAttachment::bindAttachment(), vl::FBOTexture2DAttachment::bindAttachment(), vl::FBOTexture3DAttachment::bindAttachment(), vl::FBOTextureLayerAttachment::bindAttachment(), and vl::Applet::resizeEvent().
|
friend |
Definition at line 548 of file FramebufferObject.hpp.
| std::vector< EReadDrawBuffer > vl::FramebufferObject::mDrawBuffers |
Definition at line 753 of file FramebufferObject.hpp.
| bool vl::FramebufferObject::mExternallyManaged |
Definition at line 761 of file FramebufferObject.hpp.
| std::map< EAttachmentPoint, ref<FBOAbstractAttachment> > vl::FramebufferObject::mFBOAttachments |
Definition at line 759 of file FramebufferObject.hpp.
| GLuint vl::FramebufferObject::mHandle |
Definition at line 760 of file FramebufferObject.hpp.
| int vl::FramebufferObject::mHeight |
Definition at line 757 of file FramebufferObject.hpp.
| OpenGLContext* vl::FramebufferObject::mOpenGLContext |
Definition at line 755 of file FramebufferObject.hpp.
| EReadDrawBuffer vl::FramebufferObject::mReadBuffer |
Definition at line 754 of file FramebufferObject.hpp.
| int vl::FramebufferObject::mWidth |
Definition at line 756 of file FramebufferObject.hpp.
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:50.
© Copyright Michele Bosi. All rights reserved.