Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::FrameBufferObject Class Reference

Inviwo framebuffer wrapper. More...

#include <framebufferobject.h>

Public Member Functions

 FrameBufferObject ()
 Create a new framebuffer object.
 
 FrameBufferObject (const FrameBufferObject &)=delete
 
 FrameBufferObject (FrameBufferObject &&rhs) noexcept
 
FrameBufferObjectoperator= (const FrameBufferObject &)=delete
 
FrameBufferObjectoperator= (FrameBufferObject &&rhs) noexcept
 
unsigned int getID () const
 Get the framebuffer name.
 
void activate ()
 Binds the framebuffer.
 
void deactivate ()
 Unbind the framebuffer (binds id 0)
 
bool isActive () const
 Check if this framebuffer is currently bound.
 
GLenum status () const
 Get the framebuffer status. GL_FRAMEBUFFER_COMPLETE represents a complete framebuffer. see glCheckFramebufferStatus for more details of the return value.
 
void attachTexture (Texture2D *texture, GLenum attachmentID)
 Attach a 2D Texture to the framebuffer.
 
GLenum attachColorTexture (Texture2D *texture)
 Attach a 2D Color Texture to the framebuffer.
 
GLenum attachColorTexture (Texture2D *texture, int attachmentNumber)
 Attach a 2D Color Texture to the framebuffer.
 
void attachTexture (Texture2DArray *texture, GLenum attachmentID)
 Attach a 2D Texture Array to the framebuffer.
 
GLenum attachColorTexture (Texture2DArray *texture)
 Attach a 2D Color Texture Array to the framebuffer.
 
GLenum attachColorTexture (Texture2DArray *texture, int attachmentNumber)
 Attach a 2D Color Texture Array to the framebuffer.
 
void attachTextureLayer (Texture2DArray *texture, GLenum attachmentID, int layer, int level=0)
 Attach a layer of 2D a Texture Array to the framebuffer.
 
GLenum attachColorTextureLayer (Texture2DArray *texture, int layer)
 Attach a layer of a 2D Color Texture Array to the framebuffer.
 
GLenum attachColorTextureLayer (Texture2DArray *texture, int attachmentNumber, int layer)
 Attach a layer of a 2D Color Texture Array to the framebuffer.
 
void attachTexture (Texture3D *texture, GLenum attachmentID)
 Attach a 3D Texture to the framebuffer.
 
GLenum attachColorTexture (Texture3D *texture)
 Attach a 3D Color Texture to the framebuffer.
 
GLenum attachColorTexture (Texture3D *texture, int attachmentNumber)
 Attach a 3D Color Texture to the framebuffer.
 
void attachTextureLayer (Texture3D *texture, GLenum attachmentID, int layer)
 Attach a layer of a 3D Texture to the framebuffer.
 
GLenum attachColorTextureLayer (Texture3D *texture, int layer)
 Attach a layer of a 3D Color Texture to the framebuffer. Will use the first available attachment point.
 
GLenum attachColorTextureLayer (Texture3D *texture, int attachmentNumber, int layer)
 Attach a layer of a 3D Color Texture to the framebuffer.
 
void detachTexture (GLenum attachmentID)
 Detach the texture at the given attachment point.
 
void detachAllTextures ()
 Detach all the attached textures.
 
bool hasColorAttachment () const
 Check if there are any color attachments.
 
bool hasDepthAttachment () const
 Check if there is any depth attachment.
 
bool hasStencilAttachment () const
 Check if there is any stencil attachment.
 
const std::vector< GLuint > & attachedColorTextureIds () const
 Get the current list of attached colors texture id.
 
GLuint attachedDepthTextureId () const
 Returns the texture id of the attached depth texture id or 0 if no depth is attached.
 
GLuint attachedStencilTextureId () const
 Returns the texture id of the attached stencil texture id of 0 if no stencil is attached.
 
void setReadBlit (bool set=true) const
 Bind the framebuffer name to GL_READ_FRAMEBUFFER for "Blit" reading.
 
void setDrawBlit (bool set=true)
 Bind the framebuffer name to GL_DRAW_FRAMEBUFFER for "Blit" drawing.
 

Static Public Member Functions

static void deactivateFBO ()
 Unbind the framebuffer (binds id 0)
 
static GLuint maxColorAttachments ()
 Get the maximal number of color attachments Queries GL_MAX_COLOR_ATTACHMENTS.
 

Detailed Description

Inviwo framebuffer wrapper.

Handles creation and deletion of OpenGL framebuffer objects. Has functions for attaching and detaching of textures to the framebuffer. It also keeps track of all attached texture ids. The wrapper is a move only type.

Note
An OpenGL framebuffer object is tied to a render context and only valid within the same render context that was active when creating it.

Member Function Documentation

◆ attachColorTexture() [1/6]

GLenum inviwo::FrameBufferObject::attachColorTexture ( Texture2D * texture)

Attach a 2D Color Texture to the framebuffer.

Will use the first available attachment point.

Precondition
The framebuffer must be active.
Parameters
textureto attach
Returns
The used attachment point (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTexture() [2/6]

GLenum inviwo::FrameBufferObject::attachColorTexture ( Texture2D * texture,
int attachmentNumber )

Attach a 2D Color Texture to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentNumbernumber of attachment point to use (0, 1, ...)
Returns
the attachment point used (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTexture() [3/6]

GLenum inviwo::FrameBufferObject::attachColorTexture ( Texture2DArray * texture)

Attach a 2D Color Texture Array to the framebuffer.

Will use the first available attachment point.

Precondition
The framebuffer must be active.
Parameters
textureto attach
Returns
The used attachment point (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTexture() [4/6]

GLenum inviwo::FrameBufferObject::attachColorTexture ( Texture2DArray * texture,
int attachmentNumber )

Attach a 2D Color Texture Array to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentNumbernumber of attachment point to use (0, 1, ...)
Returns
the attachment point used (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTexture() [5/6]

GLenum inviwo::FrameBufferObject::attachColorTexture ( Texture3D * texture)

Attach a 3D Color Texture to the framebuffer.

Will use the first available attachment point. Use gl_Layer in the geometry shader to set target z slice.

Precondition
The framebuffer must be active.
Parameters
textureto attach
Returns
The used attachment point (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTexture() [6/6]

GLenum inviwo::FrameBufferObject::attachColorTexture ( Texture3D * texture,
int attachmentNumber )

Attach a 3D Color Texture to the framebuffer.

Use gl_Layer in the geometry shader to set target z slice.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentNumbernumber of attachment point to use (0, 1, ...)
Returns
the attachment point used (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTextureLayer() [1/4]

GLenum inviwo::FrameBufferObject::attachColorTextureLayer ( Texture2DArray * texture,
int attachmentNumber,
int layer )

Attach a layer of a 2D Color Texture Array to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentNumbernumber of attachment point to use (0, 1, ...)
layerindex of the layer to attach
Returns
the attachment point used (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTextureLayer() [2/4]

GLenum inviwo::FrameBufferObject::attachColorTextureLayer ( Texture2DArray * texture,
int layer )

Attach a layer of a 2D Color Texture Array to the framebuffer.

Will use the first available attachment point.

Precondition
The framebuffer must be active.
Parameters
textureto attach
layerindex of the layer to attach
Returns
The used attachment point (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTextureLayer() [3/4]

GLenum inviwo::FrameBufferObject::attachColorTextureLayer ( Texture3D * texture,
int attachmentNumber,
int layer )

Attach a layer of a 3D Color Texture to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentNumbernumber of attachment point to use (0, 1, ...)
layerindex of the z layer to attach
Returns
the attachment point used (GL_COLOR_ATTACHMENT0, ... )

◆ attachColorTextureLayer() [4/4]

GLenum inviwo::FrameBufferObject::attachColorTextureLayer ( Texture3D * texture,
int layer )

Attach a layer of a 3D Color Texture to the framebuffer. Will use the first available attachment point.

Precondition
The framebuffer must be active.
Parameters
textureto attach
layerindex of the z layer to attach
Returns
The used attachment point (GL_COLOR_ATTACHMENT0, ... )

◆ attachedColorTextureIds()

const std::vector< GLuint > & inviwo::FrameBufferObject::attachedColorTextureIds ( ) const
inline

Get the current list of attached colors texture id.

Returns a list of all color attachments points, for unused points the value will be 0, for used points the value will be the attached texture id.

Returns
List of attached texture ids.

◆ attachTexture() [1/3]

void inviwo::FrameBufferObject::attachTexture ( Texture2D * texture,
GLenum attachmentID )

Attach a 2D Texture to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentIDattachment point to use (GL_COLOR_ATTACHMENT0, ... )

◆ attachTexture() [2/3]

void inviwo::FrameBufferObject::attachTexture ( Texture2DArray * texture,
GLenum attachmentID )

Attach a 2D Texture Array to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentIDattachment point to use (GL_COLOR_ATTACHMENT0, ... )

◆ attachTexture() [3/3]

void inviwo::FrameBufferObject::attachTexture ( Texture3D * texture,
GLenum attachmentID )

Attach a 3D Texture to the framebuffer.

Use gl_Layer in the geometry shader to set target z slice.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentIDattachment point to use (GL_COLOR_ATTACHMENT0, ... )

◆ attachTextureLayer() [1/2]

void inviwo::FrameBufferObject::attachTextureLayer ( Texture2DArray * texture,
GLenum attachmentID,
int layer,
int level = 0 )

Attach a layer of 2D a Texture Array to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentIDattachment point to use (GL_COLOR_ATTACHMENT0, ... )
layerindex of the layer to attach
levelthe mimpmap level to use defaults to 0

◆ attachTextureLayer() [2/2]

void inviwo::FrameBufferObject::attachTextureLayer ( Texture3D * texture,
GLenum attachmentID,
int layer )

Attach a layer of a 3D Texture to the framebuffer.

Precondition
The framebuffer must be active.
Parameters
textureto attach
attachmentIDattachment point to use (GL_COLOR_ATTACHMENT0, ... )
layerindex of the z layer to attach

◆ detachAllTextures()

void inviwo::FrameBufferObject::detachAllTextures ( )

Detach all the attached textures.

Precondition
The framebuffer must be active.

◆ detachTexture()

void inviwo::FrameBufferObject::detachTexture ( GLenum attachmentID)

Detach the texture at the given attachment point.

Precondition
The framebuffer must be active.
Parameters
attachmentIDto detach (GL_COLOR_ATTACHMENT0, ... )

◆ setDrawBlit()

void inviwo::FrameBufferObject::setDrawBlit ( bool set = true)

Bind the framebuffer name to GL_DRAW_FRAMEBUFFER for "Blit" drawing.

Parameters
setTrue will bind this buffer, False will bind id 0

◆ setReadBlit()

void inviwo::FrameBufferObject::setReadBlit ( bool set = true) const

Bind the framebuffer name to GL_READ_FRAMEBUFFER for "Blit" reading.

Parameters
setTrue will bind this buffer, False will bind id 0

◆ status()

GLenum inviwo::FrameBufferObject::status ( ) const

Get the framebuffer status. GL_FRAMEBUFFER_COMPLETE represents a complete framebuffer. see glCheckFramebufferStatus for more details of the return value.

See also
utilgl::framebufferStatusToString(GLenum)
Precondition
The framebuffer must be active.
Returns
the framebuffer status.

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