Wrap color clear in 'FBO::clear()' convenience function

This commit is contained in:
Jonas Kulla 2013-10-01 13:10:14 +02:00
parent 082a9ae483
commit 20ec560145
5 changed files with 15 additions and 10 deletions

View File

@ -186,7 +186,7 @@ struct BitmapPrivate
glState.scissorBox.pushSet(rect); glState.scissorBox.pushSet(rect);
glState.clearColor.pushSet(color); glState.clearColor.pushSet(color);
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
glState.clearColor.pop(); glState.clearColor.pop();
glState.scissorBox.pop(); glState.scissorBox.pop();
@ -569,7 +569,7 @@ void Bitmap::radialBlur(int angle, int divisions)
FBO::bind(newTex.fbo, FBO::Draw); FBO::bind(newTex.fbo, FBO::Draw);
glState.clearColor.pushSet(Vec4()); glState.clearColor.pushSet(Vec4());
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
Transform trans; Transform trans;
trans.setOrigin(Vec2(_width / 2.0f, _height / 2.0f)); trans.setOrigin(Vec2(_width / 2.0f, _height / 2.0f));
@ -618,7 +618,7 @@ void Bitmap::clear()
glState.clearColor.pushSet(Vec4()); glState.clearColor.pushSet(Vec4());
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
glState.clearColor.pop(); glState.clearColor.pop();

View File

@ -225,6 +225,11 @@ namespace FBO
return pixel; return pixel;
} }
inline void clear()
{
glClear(GL_COLOR_BUFFER_BIT);
}
} }
/* Vertex Array Object */ /* Vertex Array Object */

View File

@ -54,7 +54,7 @@ struct PingPong
TEXFBO::allocEmpty(rt[i], screenW, screenH); TEXFBO::allocEmpty(rt[i], screenW, screenH);
TEXFBO::linkFBO(rt[i]); TEXFBO::linkFBO(rt[i]);
glClearColor(0, 0, 0, 1); 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)); glState.viewport.set(IntRect(0, 0, w, h));
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
Scene::composite(); Scene::composite();
@ -414,7 +414,7 @@ struct GraphicsPrivate
void blitToScreen() void blitToScreen()
{ {
FBO::unbind(FBO::Draw); FBO::unbind(FBO::Draw);
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
blitBufferFlippedScaled(); blitBufferFlippedScaled();
} }
@ -573,7 +573,7 @@ void Graphics::transition(int duration,
/* Draw the composed frame to a buffer first /* Draw the composed frame to a buffer first
* (we need this because we're skipping PingPong) */ * (we need this because we're skipping PingPong) */
FBO::bind(p->transBuffer.fbo, FBO::Draw); FBO::bind(p->transBuffer.fbo, FBO::Draw);
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
p->screenQuad.draw(); p->screenQuad.draw();
p->checkResize(); p->checkResize();
@ -712,7 +712,7 @@ void Graphics::repaintWait(volatile bool *exitCond)
{ {
gState->checkShutdown(); gState->checkShutdown();
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
p->blitBufferFlippedScaled(); p->blitBufferFlippedScaled();
SDL_GL_SwapWindow(p->threadData->window); SDL_GL_SwapWindow(p->threadData->window);
p->fpsLimiter.delay(); p->fpsLimiter.delay();

View File

@ -607,7 +607,7 @@ struct TilemapPrivate
glState.clearColor.pushSet(Vec4()); glState.clearColor.pushSet(Vec4());
glState.scissorTest.pushSet(false); glState.scissorTest.pushSet(false);
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
glState.scissorTest.pop(); glState.scissorTest.pop();
glState.clearColor.pop(); glState.clearColor.pop();

View File

@ -428,7 +428,7 @@ struct WindowPrivate
shader.setTranslation(Vec2i()); shader.setTranslation(Vec2i());
/* Clear texture */ /* Clear texture */
glClear(GL_COLOR_BUFFER_BIT); FBO::clear();
/* Repaint base */ /* Repaint base */
windowskin->bindTex(shader); windowskin->bindTex(shader);