diff options
| author | hachem <im@hachem.wtf> | 2025-08-22 00:22:12 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-22 00:22:12 +0200 |
| commit | 0d4f5f665f2e4b735fb4f978acc6c8d4a16fcb5d (patch) | |
| tree | dad79333f7026e19732fae0e35ca9dff8ea7ade4 /src/platform/opengl/opengl_framebuffer.h | |
| parent | d8ba57f6d45b9467520377ffcc1f453154d77430 (diff) | |
feat: frame exporting
Diffstat (limited to 'src/platform/opengl/opengl_framebuffer.h')
| -rw-r--r-- | src/platform/opengl/opengl_framebuffer.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/platform/opengl/opengl_framebuffer.h b/src/platform/opengl/opengl_framebuffer.h new file mode 100644 index 0000000..7b07ddd --- /dev/null +++ b/src/platform/opengl/opengl_framebuffer.h @@ -0,0 +1,35 @@ +#pragma once + +#include "rendering/framebuffer.h" + +namespace Donut +{ + class OpenGLFramebuffer : public Framebuffer + { + public: + OpenGLFramebuffer(const FramebufferSpecification& spec); + virtual ~OpenGLFramebuffer(); + + void invalidate(); + + virtual void bind() override; + virtual void unbind() override; + + virtual void resize(uint32_t width, uint32_t height) override; + virtual int read_pixel(uint32_t attachment_index, int x, int y) override; + + virtual void clear_attachment(uint32_t attachment_index, int value) override; + virtual uint32_t get_color_attachment_renderer_id(uint32_t index = 0) const override { return m_color_attachments[index]; } + + virtual const FramebufferSpecification& get_specification() const override { return m_specification; } + private: + uint32_t m_renderer_id = 0; + FramebufferSpecification m_specification; + + std::vector<FramebufferTextureSpecification> m_color_attachment_specifications; + FramebufferTextureSpecification m_depth_attachment_specification = FramebufferTextureFormat::None; + + std::vector<uint32_t> m_color_attachments; + uint32_t m_depth_attachment = 0; + }; +}; |
