diff options
Diffstat (limited to 'src/libjin/render/canvas.cpp')
-rw-r--r-- | src/libjin/render/canvas.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libjin/render/canvas.cpp b/src/libjin/render/canvas.cpp index 376c076..89d0d77 100644 --- a/src/libjin/render/canvas.cpp +++ b/src/libjin/render/canvas.cpp @@ -6,26 +6,26 @@ namespace jin { namespace render { - Canvas::Canvas() :Drawable() + Canvas::Canvas(int w, int h) + : Drawable(w, h) { + init(); } Canvas::~Canvas() { } - // no canvas has binded shared GLint Canvas::cur = -1; - bool Canvas::init(int w, int h) + bool Canvas::init() { - Drawable::init(w, h); - Drawable::setVertices( + setVertices( new float [DRAWABLE_V_SIZE] { 0, 0, - 0, (float)h, - (float)w, (float)h, - (float)w, 0, + 0, (float)height, + (float)width, (float)height, + (float)width, 0, }, new float [DRAWABLE_V_SIZE] { 0, 1, @@ -47,7 +47,7 @@ namespace render glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); |