lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::renderer::Framebuffer Class Reference

Framebuffer class for off-screen rendering. More...

#include <framebuffer.hpp>

Public Member Functions

 Framebuffer (int width, int height, bool hdr=false)
 Constructor for the Framebuffer.
 
 ~Framebuffer ()
 Destructor for the Framebuffer.
 
void bind () const
 Bind the framebuffer.
 
void unbind () const
 Unbind the framebuffer.
 
void resize (int width, int height)
 Resize the framebuffer.
 
std::shared_ptr< Textureget_color_attachment () const
 Get the color attachment texture.
 

Detailed Description

Framebuffer class for off-screen rendering.

This class encapsulates the creation and management of an OpenGL framebuffer, including color and depth attachments.

Note
The framebuffer can be resized and bound/unbound for rendering.

Constructor & Destructor Documentation

◆ Framebuffer()

lmgl::renderer::Framebuffer::Framebuffer ( int width,
int height,
bool hdr = false )

Constructor for the Framebuffer.

Initializes the framebuffer with the specified width and height. Creates a color attachment texture and a depth attachment renderbuffer.

Parameters
widthWidth of the framebuffer.
heightHeight of the framebuffer.
hdrFlag for High Dynamic Range image Rendering.

Member Function Documentation

◆ bind()

void lmgl::renderer::Framebuffer::bind ( ) const

Bind the framebuffer.

Activates the framebuffer for subsequent rendering operations.

◆ get_color_attachment()

std::shared_ptr< Texture > lmgl::renderer::Framebuffer::get_color_attachment ( ) const
inline

Get the color attachment texture.

Returns a shared pointer to the texture used as the color attachment of the framebuffer.

Returns
Shared pointer to the color attachment texture.

◆ resize()

void lmgl::renderer::Framebuffer::resize ( int width,
int height )

Resize the framebuffer.

Adjusts the size of the framebuffer and its attachments.

Parameters
widthNew width of the framebuffer.
heightNew height of the framebuffer.

◆ unbind()

void lmgl::renderer::Framebuffer::unbind ( ) const

Unbind the framebuffer.

Deactivates the framebuffer, reverting to the default framebuffer.


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