From 8674cb8e067533839b089cff86910fddfca46897 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Mon, 2 Sep 2013 17:31:34 +0200 Subject: [PATCH] Always glClear before blitting to screen Prevents a distorted screen when an error happens during script loading (ie. before the first drawn frame) and fullscreen is turned on in the config. This will also be necessarry once fixed aspect ratio is implemented. --- src/graphics.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/graphics.cpp b/src/graphics.cpp index 294f43f..f047c12 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -565,6 +565,7 @@ struct GraphicsPrivate void blitToScreen() { FBO::unbind(FBO::Draw); + glClear(GL_COLOR_BUFFER_BIT); blitBufferFlippedScaled(); } @@ -680,6 +681,8 @@ void Graphics::transition(int duration, /* Capture new scene */ p->compositeToBuffer(p->currentScene.fbo); + /* If no transition bitmap is provided, + * we can use a simplified shader */ if (transMap) { TransShader &shader = gState->transShader(); @@ -717,12 +720,15 @@ void Graphics::transition(int duration, else gState->sTransShader().setProg(prog); + /* Draw the composed frame to a buffer first + * (we need this because we're skipping PingPong) */ FBO::bind(p->transBuffer.fbo); glClear(GL_COLOR_BUFFER_BIT); p->screenQuad.draw(); p->checkResize(); + /* Then blit it flipped and scaled to the screen */ FBO::bind(p->transBuffer.fbo, FBO::Read); p->blitToScreen(); @@ -848,6 +854,7 @@ void Graphics::repaintWait(volatile bool *exitCond) { gState->checkShutdown(); + glClear(GL_COLOR_BUFFER_BIT); p->blitBufferFlippedScaled(); SDL_GL_SwapWindow(p->threadData->window); p->fpsLimiter.delay();