diff options
author | chai <chaifix@163.com> | 2019-09-13 15:08:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-09-13 15:08:43 +0800 |
commit | 20535cb86266d7a4828009f3ddca42e35269b9e2 (patch) | |
tree | 796e77e4a34ed52b6c92fb58ec432c69ed4232e1 /src/libjin/graphics/opengl.cpp | |
parent | 695eadc9d2a6d2f499b24ee6858325f6e22da077 (diff) |
*格式化代码
Diffstat (limited to 'src/libjin/graphics/opengl.cpp')
-rw-r--r-- | src/libjin/graphics/opengl.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/libjin/graphics/opengl.cpp b/src/libjin/graphics/opengl.cpp index da3659d..c1696f4 100644 --- a/src/libjin/graphics/opengl.cpp +++ b/src/libjin/graphics/opengl.cpp @@ -52,11 +52,12 @@ namespace JinEngine void OpenGL::init() { enable(GL_BLEND); + + unbindCanvas(); + unuseShader(); setClearColor(0, 0, 0, 0xff); setColor(0xff, 0xff, 0xff, 0xff); setBlendMode(OpenGL::BlendMode::ALPHA); - unbindCanvas(); - unuseShader(); } void OpenGL::enable(GLenum cap) @@ -337,18 +338,15 @@ namespace JinEngine if (mCanvas != canvas && canvas) { GLuint fbo = canvas->getGLFrameBuffer(); - gl.bindFrameBuffer(fbo); + bindFrameBuffer(fbo); int w = canvas->getWidth(); int h = canvas->getHeight(); glViewport(0, 0, w, h); - gl.setProjectionMatrix(0, w, 0, h, -1, 1); + setProjectionMatrix(0, w, 0, h, -1, 1); mCanvas = canvas; - gl.enable(GL_BLEND); - gl.enable(GL_TEXTURE_2D); - - gl.setBlendMode(OpenGL::BlendMode::ALPHA); + setBlendMode(OpenGL::BlendMode::ALPHA); ++mStats.canvasSwitches; } @@ -367,11 +365,12 @@ namespace JinEngine return; // Get window size as viewport. Window* wnd = Window::get(); - int w = wnd->getW(); - int h = wnd->getH(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + int w = wnd->getW(), h = wnd->getH(); glViewport(0, 0, w, h); - gl.setProjectionMatrix(0, w, h, 0, -1, 1); + setProjectionMatrix(0, w, h, 0, -1, 1); + + setBlendMode(OpenGL::BlendMode::ALPHA); mCanvas = SCREEN; } |