From acd89cf669a5fb18668f5cb5762a971b0ba42801 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 25 Jan 2019 08:46:05 +0500 Subject: Added Framebuffer class --- src/Framebuffer.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Framebuffer.hpp (limited to 'src/Framebuffer.hpp') diff --git a/src/Framebuffer.hpp b/src/Framebuffer.hpp new file mode 100644 index 0000000..6e0d33e --- /dev/null +++ b/src/Framebuffer.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +class Framebuffer { + unsigned int width, height; + GLuint fbo, texColor = 0, rboDepthStencil = 0; +public: + Framebuffer(unsigned int width, unsigned int height, bool createDepthStencilBuffer); + ~Framebuffer(); + Framebuffer(const Framebuffer&) = delete; + Framebuffer(Framebuffer &&) = delete; + Framebuffer &operator=(const Framebuffer &) = delete; + Framebuffer &operator=(Framebuffer &&) = delete; + + void Activate(); + + void RenderTo(Framebuffer &target); + + void Resize(unsigned int newWidth, unsigned int newHeight); + + inline GLuint GetColor() { + return texColor; + } + + static Framebuffer &GetDefault(); + + void Clear(bool color = true, bool depth = true, bool stencil = true); +}; \ No newline at end of file -- cgit v1.2.3