![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
OpenGL framebuffer to render to. More...
#include <Framebuffer.hpp>
Public Member Functions | |
Framebuffer () | |
Constructor. | |
Framebuffer (Framebuffer &&) | |
Move constructor. | |
Framebuffer & | operator= (Framebuffer &&) |
Move assignment operator. | |
~Framebuffer () | |
Destructor. | |
void | add_colour_attachment (const int width, const int height) |
Add a colour attachment to the framebuffer. | |
void | add_depth_stencil_renderbuffer () |
Adds a depth and stencil supported renderbuffer to the framebuffer. | |
void | add_storage_attachment () |
Add an attachment to store an integer. | |
void | create () |
Construct framebuffer from attachments and renderbuffers. | |
int | read_storagebuffer (const int x, const int y) |
Read storage buffer. | |
void | clear_storagebuffer (const int val) |
Clear storagebuffer. | |
void | set_clear_colour (const graphics::Colour &col) |
Set clear colour. | |
void | begin (const bool clear=true) |
Bind framebuffer for rendering to. | |
void | end () |
Unbind framebuffer. | |
void | clear () |
Clear framebuffer attachments. | |
void | clear (const unsigned int index) |
Clear a specific attachment. | |
void | reset () |
Completely delete objects. | |
int | width () const |
Get width. | |
int | height () const |
Get height. | |
unsigned int | texture () const |
Get colour attachment texture id. | |
unsigned int | id () const |
Get OpenGL framebuffer object. | |
Private Member Functions | |
Framebuffer (const Framebuffer &)=delete | |
Copy constructor. | |
Framebuffer & | operator= (const Framebuffer &)=delete |
Copy assignment operator. | |
Private Attributes | |
unsigned int | m_id |
OpenGL handle. | |
int | m_width |
Width cache. | |
int | m_height |
Height cache. | |
unsigned int | m_colour |
Colour attachment id. | |
unsigned int | m_renderbuffer |
Renderbuffer attachment. | |
unsigned int | m_storageattach |
Storage attachment id. | |
std::array< float, 4 > | m_clear_colour |
Clear colour. | |
OpenGL framebuffer to render to.
Definition at line 20 of file Framebuffer.hpp.
galaxy::graphics::Framebuffer::Framebuffer | ( | ) |
Constructor.
Definition at line 18 of file Framebuffer.cpp.
galaxy::graphics::Framebuffer::Framebuffer | ( | Framebuffer && | f | ) |
Move constructor.
Definition at line 30 of file Framebuffer.cpp.
galaxy::graphics::Framebuffer::~Framebuffer | ( | ) |
Destructor.
Definition at line 107 of file Framebuffer.cpp.
|
privatedelete |
Copy constructor.
Framebuffer & galaxy::graphics::Framebuffer::operator= | ( | Framebuffer && | f | ) |
Move assignment operator.
Definition at line 66 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::add_colour_attachment | ( | const int | width, |
const int | height ) |
Add a colour attachment to the framebuffer.
width | Usually screen width or size of render texture. |
height | Usually screen height or size of render texture. |
Definition at line 130 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::add_depth_stencil_renderbuffer | ( | ) |
Adds a depth and stencil supported renderbuffer to the framebuffer.
Definition at line 158 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::add_storage_attachment | ( | ) |
Add an attachment to store an integer.
Definition at line 179 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::create | ( | ) |
Construct framebuffer from attachments and renderbuffers.
Definition at line 204 of file Framebuffer.cpp.
|
nodiscard |
Read storage buffer.
x | Horizontal pixel pos. |
y | Vertical pixel pos. |
Definition at line 259 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::clear_storagebuffer | ( | const int | val | ) |
Clear storagebuffer.
val | Value to clear buffer to. |
Definition at line 274 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::set_clear_colour | ( | const graphics::Colour & | col | ) |
Set clear colour.
col | Colour to clear framebuffer to. |
Definition at line 279 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::begin | ( | const bool | clear = true | ) |
Bind framebuffer for rendering to.
clear | Should the framebuffer clear attachments. |
Definition at line 289 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::end | ( | ) |
Unbind framebuffer.
Definition at line 301 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::clear | ( | ) |
Clear framebuffer attachments.
Definition at line 306 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::clear | ( | const unsigned int | index | ) |
Clear a specific attachment.
index | Specific index of attachment to clear. |
Definition at line 325 of file Framebuffer.cpp.
void galaxy::graphics::Framebuffer::reset | ( | ) |
Completely delete objects.
Definition at line 330 of file Framebuffer.cpp.
|
nodiscard |
Get width.
Definition at line 352 of file Framebuffer.cpp.
|
nodiscard |
Get height.
Definition at line 357 of file Framebuffer.cpp.
|
nodiscard |
Get colour attachment texture id.
Definition at line 362 of file Framebuffer.cpp.
|
nodiscard |
|
privatedelete |
Copy assignment operator.
|
private |
OpenGL handle.
Definition at line 167 of file Framebuffer.hpp.
|
private |
Width cache.
Definition at line 172 of file Framebuffer.hpp.
|
private |
Height cache.
Definition at line 177 of file Framebuffer.hpp.
|
private |
Colour attachment id.
Definition at line 182 of file Framebuffer.hpp.
|
private |
Renderbuffer attachment.
Definition at line 187 of file Framebuffer.hpp.
|
private |
Storage attachment id.
Definition at line 192 of file Framebuffer.hpp.
|
private |
Clear colour.
Definition at line 197 of file Framebuffer.hpp.