From 20ec560145e1f54077f764881a1b79e75325cf21 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 1 Oct 2013 13:10:14 +0200 Subject: [PATCH] Wrap color clear in 'FBO::clear()' convenience function --- src/bitmap.cpp | 6 +++--- src/gl-util.h | 5 +++++ src/graphics.cpp | 10 +++++----- src/tilemap.cpp | 2 +- src/window.cpp | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 61d2692..dd11638 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -186,7 +186,7 @@ struct BitmapPrivate glState.scissorBox.pushSet(rect); glState.clearColor.pushSet(color); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); glState.clearColor.pop(); glState.scissorBox.pop(); @@ -569,7 +569,7 @@ void Bitmap::radialBlur(int angle, int divisions) FBO::bind(newTex.fbo, FBO::Draw); glState.clearColor.pushSet(Vec4()); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); Transform trans; trans.setOrigin(Vec2(_width / 2.0f, _height / 2.0f)); @@ -618,7 +618,7 @@ void Bitmap::clear() glState.clearColor.pushSet(Vec4()); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); glState.clearColor.pop(); diff --git a/src/gl-util.h b/src/gl-util.h index 08839a1..2647247 100644 --- a/src/gl-util.h +++ b/src/gl-util.h @@ -225,6 +225,11 @@ namespace FBO return pixel; } + + inline void clear() + { + glClear(GL_COLOR_BUFFER_BIT); + } } /* Vertex Array Object */ diff --git a/src/graphics.cpp b/src/graphics.cpp index 2c22a82..d9bc573 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -54,7 +54,7 @@ struct PingPong TEXFBO::allocEmpty(rt[i], screenW, screenH); TEXFBO::linkFBO(rt[i]); glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); } } @@ -148,7 +148,7 @@ public: glState.viewport.set(IntRect(0, 0, w, h)); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); Scene::composite(); @@ -414,7 +414,7 @@ struct GraphicsPrivate void blitToScreen() { FBO::unbind(FBO::Draw); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); blitBufferFlippedScaled(); } @@ -573,7 +573,7 @@ void Graphics::transition(int duration, /* Draw the composed frame to a buffer first * (we need this because we're skipping PingPong) */ FBO::bind(p->transBuffer.fbo, FBO::Draw); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); p->screenQuad.draw(); p->checkResize(); @@ -712,7 +712,7 @@ void Graphics::repaintWait(volatile bool *exitCond) { gState->checkShutdown(); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); p->blitBufferFlippedScaled(); SDL_GL_SwapWindow(p->threadData->window); p->fpsLimiter.delay(); diff --git a/src/tilemap.cpp b/src/tilemap.cpp index e523296..ae2000e 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -607,7 +607,7 @@ struct TilemapPrivate glState.clearColor.pushSet(Vec4()); glState.scissorTest.pushSet(false); - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); glState.scissorTest.pop(); glState.clearColor.pop(); diff --git a/src/window.cpp b/src/window.cpp index 1c961a7..1a9ae17 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -428,7 +428,7 @@ struct WindowPrivate shader.setTranslation(Vec2i()); /* Clear texture */ - glClear(GL_COLOR_BUFFER_BIT); + FBO::clear(); /* Repaint base */ windowskin->bindTex(shader);