Graphite  Version 3
An experimental 3D geometry processing program
GEO::FrameBufferObject Class Reference

An OpenGL frame buffer object. More...

#include <geogram_gfx/basic/frame_buffer_object.h>

Public Member Functions

 FrameBufferObject ()
 FrameBufferObject constructor. More...
 
 ~FrameBufferObject ()
 FrameBufferObject destructor. More...
 
bool initialize (index_t width_in, index_t height_in, bool with_depth_buffer, GLint internal_storage, bool mipmaps=false)
 Initializes the FrameBufferObject. More...
 
void resize (index_t new_width, index_t new_height)
 Resizes the FrameBuferObject. More...
 
void bind_as_texture ()
 Binds this frame buffer as the input 2D texture.
 
void bind_depth_buffer_as_texture ()
 Binds the depth buffer of this frame buffer as the input 2D texture. More...
 
void bind_as_framebuffer ()
 Binds this framebuffer as the output of OpenGL rendering. More...
 
bool is_bound_as_framebuffer () const
 Tests whether this framebuffer is bound as a framebuffer. More...
 
void unbind ()
 Unbind this framebuffer. More...
 
bool initialized ()
 Tests whether this FrameBufferObject is initialized. More...
 

Public Attributes

GLuint frame_buffer_id
 The id of the frame buffer.
 
GLuint depth_buffer_id
 The id of the texture used for the depth buffer.
 
GLuint offscreen_id
 The id of the texture used for the color buffer.
 
index_t width
 The width of this frame buffer, in pixels.
 
index_t height
 The height of this frame buffer, in pixels.
 
GLint internal_storage
 The OpenGL internal storage for the color buffer.
 
GLuint previous_frame_buffer_id
 The default frame buffer object associated with the Opengl context.
 

Detailed Description

An OpenGL frame buffer object.

Definition at line 55 of file frame_buffer_object.h.

Constructor & Destructor Documentation

◆ FrameBufferObject()

GEO::FrameBufferObject::FrameBufferObject ( )

FrameBufferObject constructor.

Creates an uninitialized FrameBufferObject.

◆ ~FrameBufferObject()

GEO::FrameBufferObject::~FrameBufferObject ( )

FrameBufferObject destructor.

Releases all the allocated OpenGL resources.

Member Function Documentation

◆ bind_as_framebuffer()

void GEO::FrameBufferObject::bind_as_framebuffer ( )

Binds this framebuffer as the output of OpenGL rendering.

This memorizes the currently bound framebuffer.

◆ bind_depth_buffer_as_texture()

void GEO::FrameBufferObject::bind_depth_buffer_as_texture ( )

Binds the depth buffer of this frame buffer as the input 2D texture.

Precondition
initialize() was called with with_depth_buffer=true

◆ initialize()

bool GEO::FrameBufferObject::initialize ( index_t  width_in,
index_t  height_in,
bool  with_depth_buffer,
GLint  internal_storage,
bool  mipmaps = false 
)

Initializes the FrameBufferObject.

Parameters
[in]width_inthe width (in pixels)
[in]height_inthe height (in picels)
[in]with_depth_bufferif true, a depth buffer is also created
[in]internal_storagethe OpenGL internal storage
[in]mipmapsif true, the created textures have mipmaps

◆ initialized()

bool GEO::FrameBufferObject::initialized ( )
inline

Tests whether this FrameBufferObject is initialized.

Return values
trueif this FrameBufferObject is initialized.
falseotherwise.

Definition at line 134 of file frame_buffer_object.h.

◆ is_bound_as_framebuffer()

bool GEO::FrameBufferObject::is_bound_as_framebuffer ( ) const

Tests whether this framebuffer is bound as a framebuffer.

Return values
trueif this framebuffer is bound, i.e. used for OpenGL output.
falseotherwise

◆ resize()

void GEO::FrameBufferObject::resize ( index_t  new_width,
index_t  new_height 
)

Resizes the FrameBuferObject.

Parameters
[in]new_widththe new width, in pixels
[in]new_heightthe new height, in pixels

◆ unbind()

void GEO::FrameBufferObject::unbind ( )

Unbind this framebuffer.

This removes all the bindings (both as texture and as target of OpenGL rendering). If the framebuffer was bound as target of OpenGL rendering, this also restores the previously bound framebuffer.


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