32 #ifndef FramebufferObject_INCLUDE_ONCE 33 #define FramebufferObject_INCLUDE_ONCE 42 class FramebufferObject;
74 virtual void unbindFromAllFBO();
77 const std::set< ref<FramebufferObject> >&
fboFramebuffers()
const {
return mFramebufferObjects; }
110 void createRenderBuffer();
113 void deleteRenderBuffer();
119 void setHandle( GLuint handle ) {
if ( mHandle != handle ) { mHandle = handle; mReallocateRenderbuffer =
false; } }
122 GLuint
handle()
const {
return mHandle; }
131 void initStorage(
int w,
int h,
int samples );
141 int width()
const {
return mWidth; }
161 void setWidth(
int w ) {
if ( w != mWidth ) mReallocateRenderbuffer =
true; mWidth = w; }
167 void setHeight(
int h ) {
if ( h != mHeight ) mReallocateRenderbuffer =
true; mHeight = h; }
172 void setSamples(
int samples ) {
if ( samples != mSamples ) mReallocateRenderbuffer =
true; mSamples = samples; }
179 virtual int internalType() = 0;
202 VL_DEBUG_SET_OBJECT_NAME()
232 VL_DEBUG_SET_OBJECT_NAME()
262 VL_DEBUG_SET_OBJECT_NAME()
292 VL_DEBUG_SET_OBJECT_NAME()
322 VL_DEBUG_SET_OBJECT_NAME()
359 VL_DEBUG_SET_OBJECT_NAME()
365 VL_DEBUG_SET_OBJECT_NAME()
386 VL_DEBUG_SET_OBJECT_NAME()
393 VL_DEBUG_SET_OBJECT_NAME()
394 mTextureTarget = target;
424 VL_DEBUG_SET_OBJECT_NAME()
430 VL_DEBUG_SET_OBJECT_NAME()
451 VL_DEBUG_SET_OBJECT_NAME()
457 VL_DEBUG_SET_OBJECT_NAME()
465 int layer()
const {
return mLayer; }
488 VL_DEBUG_SET_OBJECT_NAME()
495 VL_DEBUG_SET_OBJECT_NAME()
500 int layer()
const {
return mLayer; }
559 mExternallyManaged(
false)
566 mOpenGLContext(
NULL),
570 mExternallyManaged(
false )
572 VL_DEBUG_SET_OBJECT_NAME()
586 mExternallyManaged(
false )
588 VL_DEBUG_SET_OBJECT_NAME()
589 setDrawBuffer(draw_buffer);
590 setReadBuffer(read_buffer);
604 int width()
const {
return mWidth; }
619 void bindReadBuffer();
622 void bindDrawBuffers()
const;
625 bool checkDrawBuffers()
const;
630 mDrawBuffers.clear();
631 mDrawBuffers.push_back(draw_buffer);
637 mDrawBuffers.clear();
638 mDrawBuffers.push_back(draw_buffer1);
639 mDrawBuffers.push_back(draw_buffer2);
645 mDrawBuffers.clear();
646 mDrawBuffers.push_back(draw_buffer1);
647 mDrawBuffers.push_back(draw_buffer2);
648 mDrawBuffers.push_back(draw_buffer3);
654 mDrawBuffers.clear();
655 mDrawBuffers.push_back(draw_buffer1);
656 mDrawBuffers.push_back(draw_buffer2);
657 mDrawBuffers.push_back(draw_buffer3);
658 mDrawBuffers.push_back(draw_buffer4);
662 void setDrawBuffers(
const std::vector< EReadDrawBuffer >& draw_buffers) { mDrawBuffers = draw_buffers; }
665 const std::vector< EReadDrawBuffer >&
drawBuffers() {
return mDrawBuffers; }
691 virtual GLuint
handle()
const {
return mHandle; }
707 GLenum checkFramebufferStatus();
710 void printFramebufferError( GLenum status )
const;
740 void removeAllAttachments();
743 const std::map< EAttachmentPoint, ref<FBOAbstractAttachment> >&
fboAttachments()
const {
return mFBOAttachments; }
void setLayer(int layer)
The layer of a 2-dimensional image within a 3-dimensional texture or texture array.
A 2D texture renderbuffer to be attached to a FramebufferObject (wraps glFramebufferTexture2D()).
int height() const
Returns the height of the renderbuffer storage.
void setHeight(int h)
The height of the renderbuffer storage to be allocated.
Abstract class that represents a framebuffer renderbuffer attachment, that is, a non-texture fbo atta...
int mipmapLevel() const
The mipmap level of the texture to attach.
const Texture * texture() const
The texture bound to this attachment.
std::vector< EReadDrawBuffer > mDrawBuffers
FBOTextureLayerAttachment(Texture *texture, int mipmap_level, int layer)
Constructor.
void setDrawBuffers(EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2)
Specifies a list of color buffers to be drawn into.
GLuint handle() const
Returns the handle obtained by createRenderBuffer() using glGenRenderbuffers()
~FramebufferObject()
Destructor.
EDepthBufferFormat type() const
The type to specify when allocating the renderbuffer storage.
EColorBufferFormat
Color-renderable formats as defined in section 4.4.4 of opengl api specs 4.1.
void setHeight(int height)
The height of a render target.
void setType(EDepthStencilBufferFormat type)
The type to specify when allocating the renderbuffer storage.
A 3D texture renderbuffer to be attached to a FramebufferObject (wraps glFramebufferTexture3D()).
Abstract class that represents a framebuffer object attachment to be used with FramebufferObject.
A depth+stencil renderbuffer to be attached to a FramebufferObject.
Base class for all the framebuffer texture attachments (see also FramebufferObject).
void setExternallyManaged(bool em)
Wen externallyManaged() == true then this function does nothing.
void setReadBuffer(EReadDrawBuffer read_buffer)
The read-buffer bound when the render target is activated.
FBOTexture1DAttachment(Texture *texture, int mipmap_level)
Constructor.
EDepthStencilBufferFormat
std::map< EAttachmentPoint, ref< FBOAbstractAttachment > > mFBOAttachments
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
OpenGLContext * openglContext()
The OpenGLContext bound to a render target.
A 1D texture renderbuffer to be attached to a FramebufferObject (wraps glFramebufferTexture1D()).
int layer() const
The layer of a 2-dimensional image within a 3-dimensional texture or texture array.
void setType(EDepthBufferFormat type)
The type to specify when allocating the renderbuffer storage.
Wraps an OpenGL texture object representing and managing all the supported texture types...
FBODepthBufferAttachment(EDepthBufferFormat type=DBF_DEPTH_COMPONENT)
Constructor.
virtual int internalType()
const std::map< EAttachmentPoint, ref< FBOAbstractAttachment > > & fboAttachments() const
A map associating which fbo-attachment belongs to which attachment point in a framebuffer object...
int width() const
The width of a render target.
FBOTexture1DAttachment()
Constructor.
void setDrawBuffers(const std::vector< EReadDrawBuffer > &draw_buffers)
Specifies a list of color buffers to be drawn into.
void setWidth(int width)
The width of a render target.
FBOColorBufferAttachment(EColorBufferFormat type=CBF_RGBA)
Constructor.
FBOTextureAttachment()
Constructor.
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
EReadDrawBuffer mReadBuffer
FBOAbstractAttachment()
Constructor.
FBODepthStencilBufferAttachment(EDepthStencilBufferFormat type=DSBT_DEPTH_STENCIL)
Constructor.
virtual ~FBOAbstractAttachment()
Destructor.
EDepthStencilBufferFormat mType
virtual int internalType()
int layer() const
The layer of a 2-dimensional image within a 3-dimensional texture.
EReadDrawBuffer readBuffer() const
The read-buffer bound when the render target is activated.
FBOTexture2DAttachment()
Constructor.
ETex2DTarget textureTarget() const
What type of texture is expected, or for cube map textures, which face is to be attached.
Visualization Library main namespace.
FBOTexture2DAttachment(Texture *texture, int mipmap_level, ETex2DTarget target)
Constructor.
ETex2DTarget mTextureTarget
EStencilBufferFormat type() const
The type to specify when allocating the renderbuffer storage.
void setType(EColorBufferFormat type)
The type to specify when allocating the renderbuffer storage.
FBOTexture3DAttachment(Texture *texture, int mipmap_level, int layer)
FBOTextureAttachment(Texture *texture, int mipmap_level)
Constructor.
void setHandle(GLuint handle)
Sets the handle for this attachment, the handle must have been created by glGenRenderbuffers().
void setSamples(int samples)
Sets the number of samples to be specified when allocating the renderbuffer's storage.
FBOTextureLayerAttachment()
Constructor.
bool externallyManaged() const
Wen externallyManaged() == true then this function does nothing.
The base class for all the reference counted objects.
void setDrawBuffer(EReadDrawBuffer draw_buffer)
Specifies the color buffer to be drawn into.
A color renderbuffer to be attached to a FramebufferObject.
A texture renderbuffer to be attached to a FramebufferObject (wraps glFramebufferTexture()).
void setDrawBuffers(EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3)
Specifies a list of color buffers to be drawn into.
A depth renderbuffer to be attached to a FramebufferObject.
void activate(EFramebufferBind target=FBB_FRAMEBUFFER)
Activates the FramebufferObject by calling bindFramebuffer() and bindDrawBuffers() ...
void initStorage()
The same as calling initStorage( width(), height() )
EStencilBufferFormat mType
OpenGLContext * mOpenGLContext
void setDrawBuffers(EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3, EReadDrawBuffer draw_buffer4)
Specifies a list of color buffers to be drawn into.
const std::vector< EReadDrawBuffer > & drawBuffers()
The color buffers to be drawn into.
void setMipmapLevel(int mipmap_level)
The mipmap level of the texture to attach.
FBOAbstractTextureAttachment(Texture *texture, int mipmap_level)
Constructor.
#define VLGRAPHICS_EXPORT
int samples() const
Returns the number of samples to be used when allocating the renderbuffer's storage.
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
A texture layer renderbuffer to be attached to a FramebufferObject (wraps glFramebufferTextureLayer()...
void setType(EStencilBufferFormat type)
The type to specify when allocating the renderbuffer storage.
Implements a framebuffer object to be used as a rendering target as specified by the ARB_framebuffer_...
void setTextureTarget(ETex2DTarget target)
What type of texture is expected, or for cube map textures, which face is to be attached.
std::set< ref< FramebufferObject > > mFramebufferObjects
int width() const
Returns the with of the renderbuffer storage.
void setLayer(int layer)
The layer of a 2-dimensional image within a 3-dimensional texture.
bool renderbufferStorageReady() const
Returns false if the renderbuffer storage needs to be created or reallocated due to a change of the s...
const OpenGLContext * openglContext() const
The OpenGLContext bound to a render target.
void setWidth(int w)
The width of the renderbuffer storage to be allocated.
The ref<> class is used to reference-count an Object.
Texture * texture()
The texture bound to this attachment.
EColorBufferFormat type() const
The type to specify when allocating the renderbuffer storage.
bool mReallocateRenderbuffer
int height() const
The height of a render target.
EDepthStencilBufferFormat type() const
The type to specify when allocating the renderbuffer storage.
const std::set< ref< FramebufferObject > > & fboFramebuffers() const
Returns an std::set containing the FramebufferObject that use this FBO attachment.
virtual int internalType()
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 int internalType()
void setTexture(Texture *texture)
The texture bound to this attachment.
A stencil renderbuffer to be attached to a FramebufferObject.
~FBORenderbufferAttachment()
Destructor.
FBOStencilBufferAttachment(EStencilBufferFormat type=SBF_STENCIL_INDEX8)
Constructor.