blob: 89be45c560944795b38c0551df4e024857f40304 (
plain)
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
|
#include "Canvas.h"
namespace AsuraEngine
{
namespace Graphics
{
Canvas::Canvas()
: mWidth(0)
, mHeight(0)
{
glGenFramebuffers(1, &mFBO);
GLint current_fbo;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo);
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTex, 0);
glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
}
void Canvas::SetSize(uint w, uint h)
{
GLint current_tex;
glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_tex);
glBindTexture(GL_TEXTURE_2D, mTex);
glBindTexture(GL_TEXTURE_2D, current_tex);
}
}
}
|