diff options
Diffstat (limited to 'src/libjin/graphics/je_canvas.cpp')
-rw-r--r-- | src/libjin/graphics/je_canvas.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/libjin/graphics/je_canvas.cpp b/src/libjin/graphics/je_canvas.cpp index 564121e..0a3f6f4 100644 --- a/src/libjin/graphics/je_canvas.cpp +++ b/src/libjin/graphics/je_canvas.cpp @@ -7,48 +7,48 @@ namespace JinEngine { - namespace Graphics - { + namespace Graphics + { Canvas::Canvas(GLuint n) : fbo(n) { } - Canvas::Canvas(int w, int h) - : Graphic(w, h) - { - GLint current_fbo; - glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); + Canvas::Canvas(int w, int h) + : Graphic(w, h) + { + GLint current_fbo; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); - // Generate a new render buffer object - fbo = gl.genFrameBuffer(); - gl.bindFrameBuffer(fbo); + // Generate a new render buffer object + fbo = gl.genFrameBuffer(); + gl.bindFrameBuffer(fbo); GLuint texture = getGLTexture(); - gl.bindTexture(texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - gl.texImage(GL_RGBA8, w, h, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - gl.bindTexture(0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); + gl.bindTexture(texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + gl.texImage(GL_RGBA8, w, h, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + gl.bindTexture(0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - // Unbind framebuffer - gl.bindFrameBuffer(current_fbo); - } + // Unbind framebuffer + gl.bindFrameBuffer(current_fbo); + } - Canvas::~Canvas() - { - } + Canvas::~Canvas() + { + } - bool Canvas::isBinded(const Canvas* cvs) - { - return gl.getCanvas() == cvs; - } + bool Canvas::isBinded(const Canvas* cvs) + { + return gl.getCanvas() == cvs; + } - } // namespace Graphics + } // namespace Graphics } // namespace JinEngine #endif // defined(jin_graphics)
\ No newline at end of file |