galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Framebuffer.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_GRAPHICS_GL_FRAMEBUFFER_HPP_
9#define GALAXY_GRAPHICS_GL_FRAMEBUFFER_HPP_
10
12
13namespace galaxy
14{
15 namespace graphics
16 {
20 class Framebuffer final
21 {
22 public:
27
32
37
42
49 void add_colour_attachment(const int width, const int height);
50
55
60
64 void create();
65
74 [[nodiscard]]
75 int read_storagebuffer(const int x, const int y);
76
82 void clear_storagebuffer(const int val);
83
89 void set_clear_colour(const graphics::Colour& col);
90
96 void begin(const bool clear = true);
97
101 void end();
102
106 void clear();
107
113 void clear(const unsigned int index);
114
118 void reset();
119
125 [[nodiscard]]
126 int width() const;
127
133 [[nodiscard]]
134 int height() const;
135
141 [[nodiscard]]
142 unsigned int texture() const;
143
149 [[nodiscard]]
150 unsigned int id() const;
151
152 private:
156 Framebuffer(const Framebuffer&) = delete;
157
162
163 private:
167 unsigned int m_id;
168
173
178
182 unsigned int m_colour;
183
187 unsigned int m_renderbuffer;
188
192 unsigned int m_storageattach;
193
197 std::array<float, 4> m_clear_colour;
198 };
199 } // namespace graphics
200} // namespace galaxy
201
202#endif
Represents an RGBA colour.
Definition Colour.hpp:27
OpenGL framebuffer to render to.
std::array< float, 4 > m_clear_colour
Clear colour.
unsigned int m_renderbuffer
Renderbuffer attachment.
unsigned int m_id
OpenGL handle.
void clear_storagebuffer(const int val)
Clear storagebuffer.
unsigned int m_storageattach
Storage attachment id.
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 reset()
Completely delete objects.
int width() const
Get width.
int height() const
Get height.
unsigned int id() const
Get OpenGL framebuffer object.
unsigned int texture() const
Get colour attachment texture id.
void create()
Construct framebuffer from attachments and renderbuffers.
Framebuffer & operator=(Framebuffer &&)
Move assignment operator.
int read_storagebuffer(const int x, const int y)
Read storage buffer.
unsigned int m_colour
Colour attachment id.
void end()
Unbind framebuffer.
void add_storage_attachment()
Add an attachment to store an integer.
Framebuffer(const Framebuffer &)=delete
Copy constructor.
void clear()
Clear framebuffer attachments.
void begin(const bool clear=true)
Bind framebuffer for rendering to.
void set_clear_colour(const graphics::Colour &col)
Set clear colour.
Framebuffer & operator=(const Framebuffer &)=delete
Copy assignment operator.
Animated.cpp galaxy.
Definition Animated.cpp:16