diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2019-01-25 04:46:05 +0100 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2019-01-25 04:46:05 +0100 |
commit | acd89cf669a5fb18668f5cb5762a971b0ba42801 (patch) | |
tree | 1eb2c281036a7d0757be00ae3844c7da0199e659 /src/Framebuffer.hpp | |
parent | Merge pull request #30 from uis246/iss29 (diff) | |
download | AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.tar AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.tar.gz AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.tar.bz2 AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.tar.lz AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.tar.xz AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.tar.zst AltCraft-acd89cf669a5fb18668f5cb5762a971b0ba42801.zip |
Diffstat (limited to 'src/Framebuffer.hpp')
-rw-r--r-- | src/Framebuffer.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
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 <gl/glew.h> + +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 |