Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
FramebufferObject.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef FramebufferObject_INCLUDE_ONCE
33 #define FramebufferObject_INCLUDE_ONCE
34 
35 #include <vlGraphics/Camera.hpp>
36 #include <vlGraphics/Texture.hpp>
37 #include <set>
38 #include <map>
39 
40 namespace vl
41 {
42  class FramebufferObject;
43 //-----------------------------------------------------------------------------
44 // FBOAbstractAttachment
45 //-----------------------------------------------------------------------------
56  {
58 
59  friend class FramebufferObject;
60 
61  private:
62  // no copy constructor and no assignment operator
63  FBOAbstractAttachment( const FBOAbstractAttachment& other ): Object( other ) {}
64  void operator=( const FBOAbstractAttachment& ) {}
65 
66  public:
69 
71  virtual ~FBOAbstractAttachment() { VL_CHECK(fboFramebuffers().size() == 0); }
72 
74  virtual void unbindFromAllFBO();
75 
77  const std::set< ref<FramebufferObject> >& fboFramebuffers() const { return mFramebufferObjects; }
78 
79  protected:
80  virtual void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point ) = 0;
81 
82  protected:
83  std::set< ref<FramebufferObject> > mFramebufferObjects;
84  };
85  //-----------------------------------------------------------------------------
86  // FBORenderbufferAttachment
87  //-----------------------------------------------------------------------------
94  {
96 
97  friend class FramebufferObject;
98 
99  public:
101  FBORenderbufferAttachment(): mHandle( 0 ), mWidth( 0 ), mHeight( 0 ), mSamples( 0 ), mReallocateRenderbuffer( true ) {}
102 
104  ~FBORenderbufferAttachment() { deleteRenderBuffer(); }
105 
110  void createRenderBuffer();
111 
113  void deleteRenderBuffer();
114 
119  void setHandle( GLuint handle ) { if ( mHandle != handle ) { mHandle = handle; mReallocateRenderbuffer = false; } }
120 
122  GLuint handle() const { return mHandle; }
123 
131  void initStorage( int w, int h, int samples );
132 
134  void initStorage() { initStorage( width(), height(), samples() ); }
135 
141  int width() const { return mWidth; }
142 
148  int height() const { return mHeight; }
149 
155  int samples() const { return mSamples; }
156 
161  void setWidth( int w ) { if ( w != mWidth ) /* schedules recreation */ mReallocateRenderbuffer = true; mWidth = w; }
162 
167  void setHeight( int h ) { if ( h != mHeight ) /* schedules recreation */ mReallocateRenderbuffer = true; mHeight = h; }
168 
172  void setSamples( int samples ) { if ( samples != mSamples ) /* schedules recreation */ mReallocateRenderbuffer = true; mSamples = samples; }
173 
175  bool renderbufferStorageReady() const { return !mReallocateRenderbuffer; }
176 
177  protected:
178  void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point );
179  virtual int internalType() = 0;
180 
181  protected:
182  GLuint mHandle;
183  int mWidth;
184  int mHeight;
185  int mSamples;
187  };
188  //-----------------------------------------------------------------------------
189  // FBOColorBufferAttachment
190  //-----------------------------------------------------------------------------
195  {
197 
198  public:
201  {
202  VL_DEBUG_SET_OBJECT_NAME()
203  mType = type;
204  }
205 
207  void setType( EColorBufferFormat type ) { if ( type != mType ) /* schedules recreation */ mReallocateRenderbuffer = true; mType = type; }
208 
210  EColorBufferFormat type() const { return mType; }
211 
212  protected:
213  virtual int internalType() { return type(); }
214 
215  protected:
217  };
218  //-----------------------------------------------------------------------------
219  // FBODepthBufferAttachment
220  //-----------------------------------------------------------------------------
225  {
227 
228  public:
231  {
232  VL_DEBUG_SET_OBJECT_NAME()
233  mType = type;
234  }
235 
237  void setType( EDepthBufferFormat type ) { if ( type != mType ) /* schedules recreation */ mReallocateRenderbuffer = true; mType = type; }
238 
240  EDepthBufferFormat type() const { return mType; }
241 
242  protected:
243  virtual int internalType() { return type(); }
244 
245  protected:
247  };
248  //-----------------------------------------------------------------------------
249  // FBOStencilBufferAttachment
250  //-----------------------------------------------------------------------------
255  {
257 
258  public:
261  {
262  VL_DEBUG_SET_OBJECT_NAME()
263  mType = type;
264  }
265 
267  void setType( EStencilBufferFormat type ) { if ( type != mType ) /* schedules recreation */ mReallocateRenderbuffer = true; mType = type; }
268 
270  EStencilBufferFormat type() const { return mType; }
271 
272  protected:
273  virtual int internalType() { return type(); }
274 
275  protected:
277  };
278  //-----------------------------------------------------------------------------
279  // FBODepthStencilBufferAttachment
280  //-----------------------------------------------------------------------------
285  {
287 
288  public:
291  {
292  VL_DEBUG_SET_OBJECT_NAME()
293  mType = type;
294  }
295 
297  void setType( EDepthStencilBufferFormat type ) { if ( type != mType ) /* schedules recreation */ mReallocateRenderbuffer = true; mType = type; }
298 
300  EDepthStencilBufferFormat type() const { return mType; }
301 
302  protected:
303  virtual int internalType() { return type(); }
304 
305  protected:
307  };
308  //-----------------------------------------------------------------------------
309  // FBOAbstractTextureAttachment
310  //-----------------------------------------------------------------------------
315  {
317 
318  public:
320  FBOAbstractTextureAttachment( Texture* texture, int mipmap_level ): mTexture(texture), mMipmapLevel(mipmap_level)
321  {
322  VL_DEBUG_SET_OBJECT_NAME()
323  }
324 
326  void setTexture( Texture* texture ) { mTexture = texture; }
327 
329  Texture* texture() { return mTexture.get(); }
330 
332  const Texture* texture() const { return mTexture.get(); }
333 
335  void setMipmapLevel( int mipmap_level ) { mMipmapLevel = mipmap_level; }
336 
338  int mipmapLevel() const { return mMipmapLevel; }
339 
340  protected:
343  };
344  //-----------------------------------------------------------------------------
345  // FBOTexture1DAttachment
346  //-----------------------------------------------------------------------------
352  {
354 
355  public:
358  {
359  VL_DEBUG_SET_OBJECT_NAME()
360  }
361 
363  FBOTexture1DAttachment( Texture* texture, int mipmap_level ): FBOAbstractTextureAttachment( texture, mipmap_level )
364  {
365  VL_DEBUG_SET_OBJECT_NAME()
366  }
367 
368  protected:
369  virtual void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point );
370  };
371  //-----------------------------------------------------------------------------
372  // FBOTexture2DAttachment
373  //-----------------------------------------------------------------------------
379  {
381 
382  public:
385  {
386  VL_DEBUG_SET_OBJECT_NAME()
387  mTextureTarget = T2DT_TEXTURE_2D;
388  }
389 
391  FBOTexture2DAttachment( Texture* texture, int mipmap_level, ETex2DTarget target ): FBOAbstractTextureAttachment( texture, mipmap_level )
392  {
393  VL_DEBUG_SET_OBJECT_NAME()
394  mTextureTarget = target;
395  }
396 
398  void setTextureTarget( ETex2DTarget target ) { mTextureTarget = target; }
399 
401  ETex2DTarget textureTarget() const { return mTextureTarget; }
402 
403  protected:
404  virtual void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point );
405 
406  protected:
408  };
409  //-----------------------------------------------------------------------------
410  // FBOTextureAttachment
411  //-----------------------------------------------------------------------------
417  {
419 
420  public:
423  {
424  VL_DEBUG_SET_OBJECT_NAME()
425  }
426 
428  FBOTextureAttachment( Texture* texture, int mipmap_level ): FBOAbstractTextureAttachment( texture, mipmap_level )
429  {
430  VL_DEBUG_SET_OBJECT_NAME()
431  }
432 
433  protected:
434  virtual void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point );
435 
436  };
437  //-----------------------------------------------------------------------------
438  // FBOTexture3DAttachment
439  //-----------------------------------------------------------------------------
445  {
447 
448  public:
450  {
451  VL_DEBUG_SET_OBJECT_NAME()
452  mLayer = 0;
453  }
454 
455  FBOTexture3DAttachment( Texture* texture, int mipmap_level, int layer ): FBOAbstractTextureAttachment( texture, mipmap_level )
456  {
457  VL_DEBUG_SET_OBJECT_NAME()
458  mLayer = layer;
459  }
460 
462  void setLayer( int layer ) { mLayer = layer; }
463 
465  int layer() const { return mLayer; }
466 
467  protected:
468  virtual void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point );
469 
470  protected:
471  int mLayer;
472  };
473  //-----------------------------------------------------------------------------
474  // FBOTextureLayerAttachment
475  //-----------------------------------------------------------------------------
481  {
483 
484  public:
487  {
488  VL_DEBUG_SET_OBJECT_NAME()
489  mLayer = 0;
490  }
491 
493  FBOTextureLayerAttachment( Texture* texture, int mipmap_level, int layer ): FBOAbstractTextureAttachment( texture, mipmap_level )
494  {
495  VL_DEBUG_SET_OBJECT_NAME()
496  mLayer = layer;
497  }
498 
500  int layer() const { return mLayer; }
501 
503  void setLayer( int layer ) { mLayer = layer; }
504 
505  protected:
506  virtual void bindAttachment( FramebufferObject* fbo, EAttachmentPoint attach_point );
507 
508  protected:
511  int mLayer;
512  };
513  //-----------------------------------------------------------------------------
514  // FramebufferObject
515  //-----------------------------------------------------------------------------
545  {
547 
548  friend class OpenGLContext;
549 
550  private:
551  void operator=( const FramebufferObject& ) {}
552 
553  FramebufferObject( const FramebufferObject& other ):
554  Object( other ),
555  mOpenGLContext(0),
556  mWidth(0),
557  mHeight(0),
558  mHandle( 0 ),
559  mExternallyManaged(false)
560  {
561  // setDrawBuffer(draw_buffer);
562  // setReadBuffer(read_buffer);
563  }
564 
566  mOpenGLContext(NULL),
567  mWidth(0),
568  mHeight(0),
569  mHandle( 0 ),
570  mExternallyManaged( false )
571  {
572  VL_DEBUG_SET_OBJECT_NAME()
573  setDrawBuffer(RDB_COLOR_ATTACHMENT0);
574  setReadBuffer(RDB_COLOR_ATTACHMENT0);
575  }
576 
578  int w,
579  int h,
581  EReadDrawBuffer read_buffer = RDB_COLOR_ATTACHMENT0 ):
582  mOpenGLContext(ctx),
583  mWidth(w),
584  mHeight(h),
585  mHandle( 0 ),
586  mExternallyManaged( false )
587  {
588  VL_DEBUG_SET_OBJECT_NAME()
589  setDrawBuffer(draw_buffer);
590  setReadBuffer(read_buffer);
591  }
592 
593  public:
595  ~FramebufferObject() { if (openglContext()) deleteFBO(); }
596 
598  OpenGLContext* openglContext() { return mOpenGLContext; }
599 
601  const OpenGLContext* openglContext() const { return mOpenGLContext; }
602 
604  int width() const { return mWidth; }
605 
607  int height() const { return mHeight; }
608 
610  void setWidth(int width) { mWidth = width; }
611 
613  void setHeight(int height) { mHeight = height; }
614 
616  void activate(EFramebufferBind target = FBB_FRAMEBUFFER) { bindFramebuffer(target); }
617 
619  void bindReadBuffer();
620 
622  void bindDrawBuffers() const;
623 
625  bool checkDrawBuffers() const;
626 
628  void setDrawBuffer(EReadDrawBuffer draw_buffer)
629  {
630  mDrawBuffers.clear();
631  mDrawBuffers.push_back(draw_buffer);
632  }
633 
635  void setDrawBuffers(EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2)
636  {
637  mDrawBuffers.clear();
638  mDrawBuffers.push_back(draw_buffer1);
639  mDrawBuffers.push_back(draw_buffer2);
640  }
641 
643  void setDrawBuffers(EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3)
644  {
645  mDrawBuffers.clear();
646  mDrawBuffers.push_back(draw_buffer1);
647  mDrawBuffers.push_back(draw_buffer2);
648  mDrawBuffers.push_back(draw_buffer3);
649  }
650 
652  void setDrawBuffers(EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3, EReadDrawBuffer draw_buffer4)
653  {
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);
659  }
660 
662  void setDrawBuffers(const std::vector< EReadDrawBuffer >& draw_buffers) { mDrawBuffers = draw_buffers; }
663 
665  const std::vector< EReadDrawBuffer >& drawBuffers() { return mDrawBuffers; }
666 
668  EReadDrawBuffer readBuffer() const { return mReadBuffer; }
669 
671  void setReadBuffer(EReadDrawBuffer read_buffer) { mReadBuffer = read_buffer; }
672 
673  // ---------- FramebufferObject proper functions ----------
674 
679  void createFBO();
680 
685  void deleteFBO();
686 
688  void setHandle( GLuint handle ) { mHandle = handle; }
689 
691  virtual GLuint handle() const { return mHandle; }
692 
704  virtual void bindFramebuffer( EFramebufferBind target = FBB_FRAMEBUFFER );
705 
707  GLenum checkFramebufferStatus();
708 
710  void printFramebufferError( GLenum status ) const;
711 
713  void addColorAttachment( EAttachmentPoint attach_point, FBOColorBufferAttachment* attachment );
714 
716  void addTextureAttachment( EAttachmentPoint attach_point, FBOAbstractTextureAttachment* attachment );
717 
722  void addDepthAttachment( FBOAbstractAttachment* attachment );
723 
728  void addStencilAttachment( FBOAbstractAttachment* attachment );
729 
731  void addDepthStencilAttachment( FBOAbstractAttachment* attachment );
732 
734  void removeAttachment( FBOAbstractAttachment* attachment );
735 
737  void removeAttachment( EAttachmentPoint attach_point );
738 
740  void removeAllAttachments();
741 
743  const std::map< EAttachmentPoint, ref<FBOAbstractAttachment> >& fboAttachments() const { return mFBOAttachments; }
744 
747  bool externallyManaged() const { return mExternallyManaged; }
750  void setExternallyManaged( bool em ) { mExternallyManaged = em; }
751 
752  public:
753  std::vector< EReadDrawBuffer > mDrawBuffers;
756  int mWidth;
757  int mHeight;
758 
759  std::map< EAttachmentPoint, ref<FBOAbstractAttachment> > mFBOAttachments;
760  GLuint mHandle;
762  };
763 }
764 
765 #endif
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.
EAttachmentPoint
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.
EStencilBufferFormat
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...
Definition: Texture.hpp:178
FBODepthBufferAttachment(EDepthBufferFormat type=DBF_DEPTH_COMPONENT)
Constructor.
EDepthBufferFormat
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.
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.
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
FBOAbstractAttachment()
Constructor.
FBODepthStencilBufferAttachment(EDepthStencilBufferFormat type=DSBT_DEPTH_STENCIL)
Constructor.
virtual ~FBOAbstractAttachment()
Destructor.
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.
ETex2DTarget
ETex2DTarget textureTarget() const
What type of texture is expected, or for cube map textures, which face is to be attached.
EReadDrawBuffer
Visualization Library main namespace.
FBOTexture2DAttachment(Texture *texture, int mipmap_level, ETex2DTarget target)
Constructor.
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&#39;s storage.
bool externallyManaged() const
Wen externallyManaged() == true then this function does nothing.
The base class for all the reference counted objects.
Definition: Object.hpp:158
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() )
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.
#define NULL
Definition: OpenGLDefs.hpp:81
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.
EFramebufferBind
int samples() const
Returns the number of samples to be used when allocating the renderbuffer&#39;s storage.
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:145
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.
Definition: Object.hpp:55
Texture * texture()
The texture bound to this attachment.
EColorBufferFormat type() const
The type to specify when allocating the renderbuffer storage.
#define VL_CHECK(expr)
Definition: checks.hpp:73
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.
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.
void setTexture(Texture *texture)
The texture bound to this attachment.
A stencil renderbuffer to be attached to a FramebufferObject.
FBOStencilBufferAttachment(EStencilBufferFormat type=SBF_STENCIL_INDEX8)
Constructor.