Molecular Vis
Improving perception of molecular visualization
FBO Class Reference

Class for handling render to texture using framebuffer objects. More...

#include <FBO.h>

Public Member Functions

 FBO (bool useTextureColor, bool useTextureDepth, bool multiSample, unsigned int width, unsigned int height, bool addSecondColorBuffer=false)
 
 FBO (unsigned int nrColorTexture, bool useDepthTexture, bool useMultisampling, unsigned int width, unsigned int height)
 
const unsigned int getColorTexture (unsigned int i) const
 
const unsigned int getColorTexture () const
 
const unsigned int getSecondaryColorTexture () const
 
const unsigned int getDepthTexture () const
 
const bool isMultiSample () const
 
void setActive ()
 

Static Public Member Functions

static void copyFBO (const FBO &from, const FBO &to, unsigned int bufferMask=GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
 
static void copyFBO (const FBO &from, unsigned int to, unsigned int bufferMask=GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
 
static void copyFBO (unsigned int from, const FBO &to, unsigned int bufferMask=GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
 

Static Public Attributes

static unsigned int MULTI_SAMPLE_COUNT = 16
 

Detailed Description

Class for handling render to texture using framebuffer objects.

Constructor & Destructor Documentation

◆ FBO() [1/2]

FBO::FBO ( bool  useTextureColor,
bool  useTextureDepth,
bool  multiSample,
unsigned int  width,
unsigned int  height,
bool  addSecondColorBuffer = false 
)

Creates a FBO with at most two color textures and one depth texture

Parameters
useTextureColorif a color texture is used
useTextureDepthif a depth texture is used
multiSampleif multisampling should be enabled
widthwidth of the framebuffer and textures
heightheight of the framebuffer and textures
addSecondColorBufferif an additional color texture should be attached.

◆ FBO() [2/2]

FBO::FBO ( unsigned int  nrColorTexture,
bool  useDepthTexture,
bool  useMultisampling,
unsigned int  width,
unsigned int  height 
)

Creates a FBO with a arbitrary number of color textures.

Parameters
nrColorTexturenr of color textures attached.
useDepthTextureif a depth texture is used
useMultisamplingif multisampling should be enabled
widthwidth of the framebuffer and textures
heightheight of the framebuffer and textures

Member Function Documentation

◆ copyFBO() [1/3]

void FBO::copyFBO ( const FBO from,
const FBO to,
unsigned int  bufferMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT 
)
static

Copys fbo data from one fbo to an other.

Parameters
fromwhere to copy from
towhere to copy to
bufferMaskwhat to copy. See openGL documentaiton of glBlitFramebuffer

◆ copyFBO() [2/3]

void FBO::copyFBO ( const FBO from,
unsigned int  to,
unsigned int  bufferMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ copyFBO() [3/3]

void FBO::copyFBO ( unsigned int  from,
const FBO to,
unsigned int  bufferMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getColorTexture() [1/2]

const unsigned int FBO::getColorTexture ( unsigned int  i) const
inline

Gets the handle of the i-th color texture, counted from 0. Handle can then be used in glBindTexture etc. The texture is either a GL_TEXTURE_2D or GL_TEXTURE_2D_MULTISAMPLE, depending on if multisampling is enabled or not.

Parameters
iindex of the texture
Returns
handle of texture at index 0

◆ getColorTexture() [2/2]

const unsigned int FBO::getColorTexture ( ) const
inline

Convinience method for getColorTexture(0)

Returns
handle of first color texture

◆ getDepthTexture()

const unsigned int FBO::getDepthTexture ( ) const
inline

Gets the handle of the depth texture. Handle can then be used in glBindTexture etc. The texture is either a GL_TEXTURE_2D or GL_TEXTURE_2D_MULTISAMPLE, depending on if multisampling is enabled or not.

Returns
handle of depth texture

◆ getSecondaryColorTexture()

const unsigned int FBO::getSecondaryColorTexture ( ) const
inline

convinience method for getColorTexture(1)

Returns
handle of first color texture

◆ isMultiSample()

const bool FBO::isMultiSample ( ) const
inline

Checks if FBO has multisampling enabled

◆ setActive()

void FBO::setActive ( )

Prepares FBO for rendering. All draw commands after calling this output to attached textures.

Member Data Documentation

◆ MULTI_SAMPLE_COUNT

unsigned int FBO::MULTI_SAMPLE_COUNT = 16
static

Multisample count if multisampling is enebled.


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