Geogram Version 1.9.9
A programming library of geometric algorithms
Loading...
Searching...
No Matches
GEO::FrameBufferObject Class Reference

An OpenGL frame buffer object. More...

#include <geogram_gfx/basic/frame_buffer_object.h>

Public Member Functions

 FrameBufferObject ()
 FrameBufferObject constructor.
 
 ~FrameBufferObject ()
 FrameBufferObject destructor.
 
bool initialize (index_t width_in, index_t height_in, bool with_depth_buffer, GLint internal_storage, bool mipmaps=false)
 Initializes the FrameBufferObject.
 
void resize (index_t new_width, index_t new_height)
 Resizes the FrameBuferObject.
 
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.
 
void bind_as_framebuffer ()
 Binds this framebuffer as the output of OpenGL rendering.
 
bool is_bound_as_framebuffer () const
 Tests whether this framebuffer is bound as a framebuffer.
 
void unbind ()
 Unbind this framebuffer.
 
bool initialized ()
 Tests whether this FrameBufferObject is initialized.
 

Static Public Member Functions

static GLuint bound_framebuffer_id ()
 Gets the currently bound FrameBufferObject.
 

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.
 

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

◆ bound_framebuffer_id()

static GLuint GEO::FrameBufferObject::bound_framebuffer_id ( )
inlinestatic

Gets the currently bound FrameBufferObject.

Returns
the OpenGL id of the currently bound FrameBufferObject

Definition at line 142 of file frame_buffer_object.h.

◆ 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, then target of OpenGL rendering is reset to zero.

Member Data Documentation

◆ depth_buffer_id

GLuint GEO::FrameBufferObject::depth_buffer_id

The id of the texture used for the depth buffer.

Definition at line 156 of file frame_buffer_object.h.

◆ frame_buffer_id

GLuint GEO::FrameBufferObject::frame_buffer_id

The id of the frame buffer.

Definition at line 151 of file frame_buffer_object.h.

◆ height

index_t GEO::FrameBufferObject::height

The height of this frame buffer, in pixels.

Definition at line 171 of file frame_buffer_object.h.

◆ internal_storage

GLint GEO::FrameBufferObject::internal_storage

The OpenGL internal storage for the color buffer.

Definition at line 176 of file frame_buffer_object.h.

◆ offscreen_id

GLuint GEO::FrameBufferObject::offscreen_id

The id of the texture used for the color buffer.

Definition at line 161 of file frame_buffer_object.h.

◆ width

index_t GEO::FrameBufferObject::width

The width of this frame buffer, in pixels.

Definition at line 166 of file frame_buffer_object.h.


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