Developer Documentation
ACG::FBO Class Reference

#include <AC>

Classes

struct  RenderTexture
 attached textures More...
 

Public Member Functions

 FBO ()
 Default constructor. More...
 
 ~FBO ()
 Destructor. More...
 
void init ()
 function to generate the framebuffer object More...
 
void del ()
 delete fbo and all internally created render textures More...
 
GLsizei setMultisampling (GLsizei _samples, GLboolean _fixedsamplelocations=GL_TRUE)
 
GLsizei getMultisamplingCount () const
 get number of samples More...
 
void attachTexture (GLenum _attachment, GLuint _texture, GLuint _level=0)
 attach a texture of arbitrary dimension (requires OpenGL 3.2) More...
 
void attachTexture2D (GLenum _attachment, GLsizei _width, GLsizei _height, GLuint _internalFmt, GLenum _format, GLint _wrapMode=GL_CLAMP_TO_EDGE, GLint _minFilter=GL_NEAREST, GLint _magFilter=GL_NEAREST)
 function to attach a texture to fbo More...
 
void attachTexture2D (GLenum _attachment, GLuint _texture, GLenum _target=GL_TEXTURE_2D)
 function to attach a texture to fbo More...
 
void attachTexture2DDepth (GLsizei _width, GLsizei _height, GLuint _internalFmt=GL_DEPTH_COMPONENT32, GLenum _format=GL_DEPTH_COMPONENT)
 function to attach a depth-buffer texture to fbo (using GL_DEPTH_ATTACHMENT) More...
 
void attachTexture2DStencil (GLsizei _width, GLsizei _height)
 function to attach a stencil-buffer texture to fbo (texformat = GL_STENCIL_INDEX8) More...
 
void attachTexture3D (GLenum _attachment, GLsizei _width, GLsizei _height, GLsizei _depth, GLuint _internalFmt, GLenum _format, GLint _wrapMode=GL_CLAMP, GLint _minFilter=GL_NEAREST, GLint _magFilter=GL_NEAREST)
 
void addDepthBuffer (GLuint _width, GLuint _height)
 function to add a depth renderbuffer to the fbo More...
 
void addStencilBuffer (GLuint _width, GLuint _height)
 function to add a stencil renderbuffer to the fbo More...
 
void addDepthStencilBuffer (GLuint _width, GLuint _height)
 add a packed depth24_stencil8 renderbuffer More...
 
GLuint getAttachment (GLenum _attachment)
 return attached texture id More...
 
GLuint getInternalFormat (GLenum _attachment)
 return internal texture format of attachment More...
 
GLuint getFboID ()
 return opengl id More...
 
void resize (GLsizei _width, GLsizei _height, bool _forceResize=false)
 resize function (if textures created by this class) More...
 
GLsizei width () const
 get width of fbo texture More...
 
GLsizei height () const
 get height of fbo texture More...
 
ACG::Vec2i size () const
 get width and height of fbo texture More...
 
bool bind ()
 bind the fbo and sets it as rendertarget More...
 
void unbind ()
 unbind fbo, go to normal rendering mode More...
 
bool checkFramebufferStatus ()
 function to check the framebuffer status More...
 

Private Types

typedef std::map< GLenum, RenderTextureAttachmentList
 

Private Attributes

GLuint fbo_
 handle of frame buffer object More...
 
GLuint depthbuffer_
 depthbuffer More...
 
GLuint stencilbuffer_
 stencilbuffer More...
 
AttachmentList attachments_
 
GLsizei width_
 width and height of render textures More...
 
GLsizei height_
 
GLsizei samples_
 sample count if multisampling More...
 
GLboolean fixedsamplelocation_
 enable fixed sample location if multisampling More...
 
GLuint prevFbo_
 handle of previously bound fbo More...
 
GLuint prevDrawBuffer_
 

Detailed Description

/.../FBO.hh>

Brief Description.

A more elaborate description follows.

Definition at line 71 of file FBO.hh.

Member Typedef Documentation

◆ AttachmentList

typedef std::map<GLenum, RenderTexture> ACG::FBO::AttachmentList
private

Definition at line 202 of file FBO.hh.

Constructor & Destructor Documentation

◆ FBO()

ACG::FBO::FBO ( )

Default constructor.

Definition at line 71 of file FBO.cc.

◆ ~FBO()

ACG::FBO::~FBO ( )

Destructor.

Definition at line 76 of file FBO.cc.

Member Function Documentation

◆ addDepthBuffer()

void ACG::FBO::addDepthBuffer ( GLuint  _width,
GLuint  _height 
)

function to add a depth renderbuffer to the fbo

Definition at line 349 of file FBO.cc.

◆ addDepthStencilBuffer()

void ACG::FBO::addDepthStencilBuffer ( GLuint  _width,
GLuint  _height 
)

add a packed depth24_stencil8 renderbuffer

Definition at line 415 of file FBO.cc.

◆ addStencilBuffer()

void ACG::FBO::addStencilBuffer ( GLuint  _width,
GLuint  _height 
)

function to add a stencil renderbuffer to the fbo

Definition at line 382 of file FBO.cc.

◆ attachTexture()

void ACG::FBO::attachTexture ( GLenum  _attachment,
GLuint  _texture,
GLuint  _level = 0 
)

attach a texture of arbitrary dimension (requires OpenGL 3.2)

Definition at line 133 of file FBO.cc.

◆ attachTexture2D() [1/2]

void ACG::FBO::attachTexture2D ( GLenum  _attachment,
GLsizei  _width,
GLsizei  _height,
GLuint  _internalFmt,
GLenum  _format,
GLint  _wrapMode = GL_CLAMP_TO_EDGE,
GLint  _minFilter = GL_NEAREST,
GLint  _magFilter = GL_NEAREST 
)

function to attach a texture to fbo

Definition at line 207 of file FBO.cc.

◆ attachTexture2D() [2/2]

void ACG::FBO::attachTexture2D ( GLenum  _attachment,
GLuint  _texture,
GLenum  _target = GL_TEXTURE_2D 
)

function to attach a texture to fbo

Definition at line 173 of file FBO.cc.

◆ attachTexture2DDepth()

void ACG::FBO::attachTexture2DDepth ( GLsizei  _width,
GLsizei  _height,
GLuint  _internalFmt = GL_DEPTH_COMPONENT32,
GLenum  _format = GL_DEPTH_COMPONENT 
)

function to attach a depth-buffer texture to fbo (using GL_DEPTH_ATTACHMENT)

Definition at line 334 of file FBO.cc.

◆ attachTexture2DStencil()

void ACG::FBO::attachTexture2DStencil ( GLsizei  _width,
GLsizei  _height 
)

function to attach a stencil-buffer texture to fbo (texformat = GL_STENCIL_INDEX8)

Definition at line 341 of file FBO.cc.

◆ attachTexture3D()

void ACG::FBO::attachTexture3D ( GLenum  _attachment,
GLsizei  _width,
GLsizei  _height,
GLsizei  _depth,
GLuint  _internalFmt,
GLenum  _format,
GLint  _wrapMode = GL_CLAMP,
GLint  _minFilter = GL_NEAREST,
GLint  _magFilter = GL_NEAREST 
)

attach a 3D texture for render to volume (requires OpenGL 3.2) binds all slices at once, target slice has to be chosen via gl_Layer in geometry shader

Definition at line 286 of file FBO.cc.

◆ bind()

bool ACG::FBO::bind ( )

bind the fbo and sets it as rendertarget

Definition at line 457 of file FBO.cc.

◆ checkFramebufferStatus()

bool ACG::FBO::checkFramebufferStatus ( )

function to check the framebuffer status

Definition at line 491 of file FBO.cc.

◆ del()

void ACG::FBO::del ( )

delete fbo and all internally created render textures

Definition at line 111 of file FBO.cc.

◆ getAttachment()

GLuint ACG::FBO::getAttachment ( GLenum  _attachment)

return attached texture id

Definition at line 536 of file FBO.cc.

◆ getFboID()

GLuint ACG::FBO::getFboID ( )

return opengl id

Definition at line 604 of file FBO.cc.

◆ getInternalFormat()

GLuint ACG::FBO::getInternalFormat ( GLenum  _attachment)

return internal texture format of attachment

Definition at line 543 of file FBO.cc.

◆ getMultisamplingCount()

GLsizei ACG::FBO::getMultisamplingCount ( ) const
inline

get number of samples

Definition at line 93 of file FBO.hh.

◆ height()

GLsizei ACG::FBO::height ( ) const
inline

get height of fbo texture

Definition at line 152 of file FBO.hh.

◆ init()

void ACG::FBO::init ( )

function to generate the framebuffer object

Definition at line 85 of file FBO.cc.

◆ resize()

void ACG::FBO::resize ( GLsizei  _width,
GLsizei  _height,
bool  _forceResize = false 
)

resize function (if textures created by this class)

Definition at line 550 of file FBO.cc.

◆ setMultisampling()

GLsizei ACG::FBO::setMultisampling ( GLsizei  _samples,
GLboolean  _fixedsamplelocations = GL_TRUE 
)

enable/disable multisampling returns the MSAA sample count of the fbo, which might not be equal to the requested _samples count but you'll get something close

Definition at line 609 of file FBO.cc.

◆ size()

ACG::Vec2i ACG::FBO::size ( ) const
inline

get width and height of fbo texture

Definition at line 155 of file FBO.hh.

◆ unbind()

void ACG::FBO::unbind ( )

unbind fbo, go to normal rendering mode

Definition at line 480 of file FBO.cc.

◆ width()

GLsizei ACG::FBO::width ( ) const
inline

get width of fbo texture

Definition at line 149 of file FBO.hh.

Member Data Documentation

◆ attachments_

AttachmentList ACG::FBO::attachments_
private

Definition at line 203 of file FBO.hh.

◆ depthbuffer_

GLuint ACG::FBO::depthbuffer_
private

depthbuffer

Definition at line 172 of file FBO.hh.

◆ fbo_

GLuint ACG::FBO::fbo_
private

handle of frame buffer object

Definition at line 169 of file FBO.hh.

◆ fixedsamplelocation_

GLboolean ACG::FBO::fixedsamplelocation_
private

enable fixed sample location if multisampling

Definition at line 213 of file FBO.hh.

◆ height_

GLsizei ACG::FBO::height_
private

Definition at line 207 of file FBO.hh.

◆ prevDrawBuffer_

GLuint ACG::FBO::prevDrawBuffer_
private

Definition at line 218 of file FBO.hh.

◆ prevFbo_

GLuint ACG::FBO::prevFbo_
private

handle of previously bound fbo

Definition at line 217 of file FBO.hh.

◆ samples_

GLsizei ACG::FBO::samples_
private

sample count if multisampling

Definition at line 210 of file FBO.hh.

◆ stencilbuffer_

GLuint ACG::FBO::stencilbuffer_
private

stencilbuffer

Definition at line 175 of file FBO.hh.

◆ width_

GLsizei ACG::FBO::width_
private

width and height of render textures

Definition at line 207 of file FBO.hh.


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