From 0d4f5f665f2e4b735fb4f978acc6c8d4a16fcb5d Mon Sep 17 00:00:00 2001 From: hachem Date: Fri, 22 Aug 2025 00:22:12 +0200 Subject: feat: frame exporting --- src/platform/opengl/opengl_framebuffer.h | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/platform/opengl/opengl_framebuffer.h (limited to 'src/platform/opengl/opengl_framebuffer.h') 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 m_color_attachment_specifications; + FramebufferTextureSpecification m_depth_attachment_specification = FramebufferTextureFormat::None; + + std::vector m_color_attachments; + uint32_t m_depth_attachment = 0; + }; +}; -- cgit v1.3