GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
Glip::CoreGL::HdlFBO Class Reference

Object handle for OpenGL Frame Buffer Objects. More...

#include <HdlFBO.hpp>

Inheritance diagram for Glip::CoreGL::HdlFBO:
Inheritance graph

Public Member Functions

 HdlFBO (const HdlAbstractTextureFormat &f, int numTarget=1)
 HdlFBO Construtor. More...
 
int addTarget (void)
 Add a new texture to target list.
 
int getNumTargets (void) const
 Get the number of targets. More...
 
int getAttachmentCount (void) const
 Return the number of attachment points. More...
 
void addDepthBuffer (void)
 Add a depth buffer to this Framebuffer object.
 
bool hasDepthBuffer (void)
 Test if a depth buffer is currently attached to this object. More...
 
void removeDepthBuffer (void)
 Remove the depth buffer currently attached to this frame buffer.
 
void beginRendering (int usedTarget=0, bool useExistingDepthBuffer=false)
 Prepare the FBO for rendering in it. More...
 
void endRendering (void)
 End the rendering in the FBO, build the mipmaps for the target.
 
void bind (void)
 Bind this FBO.
 
HdlTextureoperator[] (int i)
 Get a target of the FBO. More...
 
size_t getSize (bool askDriver=false)
 Gets the size of the FBO in bytes. More...
 
GLenum test (void)
 Test the validity of a FBO object. More...
 
- Public Member Functions inherited from Glip::CoreGL::HdlAbstractTextureFormat
int getWidth (void) const
 
int getHeight (void) const
 
int getNumPixels (void) const
 
int getNumChannels (void) const
 
int getNumElements (void) const
 
int getAlignment (void) const
 
int getPixelSize (void) const
 
virtual size_t getRowSize (void) const
 
virtual size_t getSize (void) const
 
int getChannelDepth (void) const
 
GLenum getGLMode (void) const
 
GLenum getGLDepth (void) const
 
GLenum getMinFilter (void) const
 
GLenum getMagFilter (void) const
 
int getBaseLevel (void) const
 
int getMaxLevel (void) const
 
GLenum getSWrapping (void) const
 
GLenum getTWrapping (void) const
 
bool isCompressed (void) const
 
bool isFloatingPoint (void) const
 
const HdlTextureFormatDescriptorgetFormatDescriptor (void) const
 
bool operator== (const HdlAbstractTextureFormat &) const
 
bool operator!= (const HdlAbstractTextureFormat &) const
 
bool isCompatibleWith (const HdlAbstractTextureFormat &) const
 Check if the two formats share the same memory characteristics (sizes, number of channels, byte per pixel, internal GL mode, same mipmap levels). More...
 
HdlAbstractTextureFormat getCompressedFormat (void) const
 Get the equivalent, but compressed, format. More...
 
HdlAbstractTextureFormat getUncompressedFormat (void) const
 Get the equivalent, but uncompressed, format. More...
 
bool isCorrespondingCompressedFormat (const HdlAbstractTextureFormat &) const
 Check if this and f share the same memory parameters except that the mode for f is the corresponding compressed mode of this. More...
 
virtual unsigned int getSetting (GLenum param) const
 Obtain a setting value based on its GL name. More...
 

Static Public Member Functions

static int getMaximumColorAttachment (void)
 Get the maximum number of attachment points. More...
 
static GLenum getAttachment (int i)
 Convert an attachment ID to the corresponding OpenGL constant. More...
 
static int getIndexFromAttachment (GLenum attachment)
 Convert an OpenGL constant to the corresponding attachment ID. More...
 
static void unbind (void)
 Unbind the FBO which is currently bound to the OpenGL context.
 
- Static Public Member Functions inherited from Glip::CoreGL::HdlAbstractTextureFormat
static int getMaxSize (void)
 Returns the maximum size for a texture. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Glip::CoreGL::HdlAbstractTextureFormat
 HdlAbstractTextureFormat (int _width, int _height, GLenum _mode, GLenum _depth, GLenum _minFilter=GL_NEAREST, GLenum _magFilter=GL_NEAREST, GLenum _wraps=GL_CLAMP, GLenum _wrapt=GL_CLAMP, int _baseLevel=0, int _maxLevel=0)
 HdlAbstractTextureFormat Construtor. More...
 
 HdlAbstractTextureFormat (const HdlAbstractTextureFormat &copy)
 HdlAbstractTextureFormat Construtor. More...
 
void setAlignment (int _alignment)
 Set the alignment for this format. More...
 

Detailed Description

Object handle for OpenGL Frame Buffer Objects.

This class can manage a Frame Buffer Object and multiple rendering target, each one of these rendering target have the same format.

Constructor & Destructor Documentation

HdlFBO::HdlFBO ( const HdlAbstractTextureFormat f,
int  numTarget = 1 
)

HdlFBO Construtor.

Parameters
fFormat of the textures attached to the rendering point.
numTargetNumber of targets to be built by the constructor.

Member Function Documentation

void HdlFBO::beginRendering ( int  usedTarget = 0,
bool  useExistingDepthBuffer = false 
)

Prepare the FBO for rendering in it.

Parameters
usedTargetThe number of targets to be used. It must be greater or equal to 1 and less or equal to getAttachmentCount(). Default is 0 which means all targets.
usedTargetNumber of targets used in this FBO.
useExistingDepthBufferIf true and if a depth buffer is currently attached, it will be used (see HdlFBO::addDepthBuffer).
GLenum HdlFBO::getAttachment ( int  i)
static

Convert an attachment ID to the corresponding OpenGL constant.

Parameters
iThe ID of the attachment point.
Returns
The corresponding OpenGL constant.
int HdlFBO::getAttachmentCount ( void  ) const

Return the number of attachment points.

Returns
The number of attached textures.
int HdlFBO::getIndexFromAttachment ( GLenum  attachment)
static

Convert an OpenGL constant to the corresponding attachment ID.

Parameters
attachmentThe OpenGL constant representing the attachment point.
Returns
The corresponding ID.
int HdlFBO::getMaximumColorAttachment ( void  )
static

Get the maximum number of attachment points.

Returns
The maximum number of attachment points.
int HdlFBO::getNumTargets ( void  ) const

Get the number of targets.

Returns
The current number of targets.
size_t HdlFBO::getSize ( bool  askDriver = false)

Gets the size of the FBO in bytes.

Parameters
askDriverIf true, it will use HdlTexture::getSizeOnGPU() to determine the real size (might be slower).
Returns
The size in byte of the multiple targets.
bool HdlFBO::hasDepthBuffer ( void  )

Test if a depth buffer is currently attached to this object.

Returns
True if a depth buffer is currently attached.
HdlTexture * HdlFBO::operator[] ( int  i)

Get a target of the FBO.

Parameters
iIndex of the target.
Returns
Pointer to the corresponding target.
GLenum HdlFBO::test ( void  )

Test the validity of a FBO object.

Returns
An error code among : GL_FRAMEBUFFER_COMPLETE, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER, GL_FRAMEBUFFER_UNSUPPORTED, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS. See https://www.opengl.org/wiki/GLAPI/glCheckFramebufferStatus for more information.

The documentation for this class was generated from the following files: