Geogram
Version 1.9.1
A programming library of geometric algorithms
|
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. | |
An OpenGL frame buffer object.
Definition at line 55 of file frame_buffer_object.h.
GEO::FrameBufferObject::FrameBufferObject | ( | ) |
FrameBufferObject constructor.
Creates an uninitialized FrameBufferObject.
GEO::FrameBufferObject::~FrameBufferObject | ( | ) |
FrameBufferObject destructor.
Releases all the allocated OpenGL resources.
void GEO::FrameBufferObject::bind_as_framebuffer | ( | ) |
Binds this framebuffer as the output of OpenGL rendering.
This memorizes the currently bound framebuffer.
void GEO::FrameBufferObject::bind_depth_buffer_as_texture | ( | ) |
Binds the depth buffer of this frame buffer as the input 2D texture.
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.
[in] | width_in | the width (in pixels) |
[in] | height_in | the height (in picels) |
[in] | with_depth_buffer | if true, a depth buffer is also created |
[in] | internal_storage | the OpenGL internal storage |
[in] | mipmaps | if true, the created textures have mipmaps |
|
inline |
Tests whether this FrameBufferObject is initialized.
true | if this FrameBufferObject is initialized. |
false | otherwise. |
Definition at line 134 of file frame_buffer_object.h.
bool GEO::FrameBufferObject::is_bound_as_framebuffer | ( | ) | const |
Tests whether this framebuffer is bound as a framebuffer.
true | if this framebuffer is bound, i.e. used for OpenGL output. |
false | otherwise |
Resizes the FrameBuferObject.
[in] | new_width | the new width, in pixels |
[in] | new_height | the new height, in pixels |
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.