summaryrefslogtreecommitdiffstats
path: root/src/Framebuffer.hpp
blob: 6e0d33edac4a291a8afe4f6bf8e7298994d13484 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
};