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]] int read_storagebuffer(const int x, const int y);
75
81 void clear_storagebuffer(const int val);
82
88 void set_clear_colour(const graphics::Colour& col);
89
95 void begin(const bool clear = true);
96
100 void end();
101
105 void clear();
106
112 void clear(const unsigned int index);
113
117 void reset();
118
124 [[nodiscard]] int width() const;
125
131 [[nodiscard]] int height() const;
132
138 [[nodiscard]] unsigned int texture() const;
139
145 [[nodiscard]] unsigned int id() const;
146
147 private:
151 Framebuffer(const Framebuffer&) = delete;
152
157
158 private:
162 unsigned int m_id;
163
168
173
177 unsigned int m_colour;
178
182 unsigned int m_renderbuffer;
183
187 unsigned int m_storageattach;
188
192 std::array<float, 4> m_clear_colour;
193 };
194 } // namespace graphics
195} // namespace galaxy
196
197#endif
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