-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframebuffer.h
49 lines (31 loc) · 846 Bytes
/
framebuffer.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _FRAMEBUFFER_H
#define _FRAMEBUFFER_H
#include "texture.h"
#include "shader.h"
class Framebuffer
{
public:
Framebuffer(int width, int height, bool depth = false);
~Framebuffer();
void Start(float downSamplingRatio = 1.0);
void End();
void Bind(Shader *shader, glm::vec2 resolution, string textureName) const;
void Init();
void Clear() const;
void AttachTexture(Texture2D *renderTexture_, string texturenName_);
void Resize(int width, int height);
void Upscale(float ratio);
int Width() const;
int Height() const;
Texture2D *GetRenderTexture() const;
GLuint id;
GLuint depthId;
private:
void ScaleRenderTarget(float ratio);
int width, height;
Texture2D *renderTexture;
string textureName;
bool depth;
float currentSampleRatio;
};
#endif