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.
This commit is contained in:
parent
0477c3f8db
commit
8674cb8e06
|
@ -565,6 +565,7 @@ struct GraphicsPrivate
|
||||||
void blitToScreen()
|
void blitToScreen()
|
||||||
{
|
{
|
||||||
FBO::unbind(FBO::Draw);
|
FBO::unbind(FBO::Draw);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
blitBufferFlippedScaled();
|
blitBufferFlippedScaled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,6 +681,8 @@ void Graphics::transition(int duration,
|
||||||
/* Capture new scene */
|
/* Capture new scene */
|
||||||
p->compositeToBuffer(p->currentScene.fbo);
|
p->compositeToBuffer(p->currentScene.fbo);
|
||||||
|
|
||||||
|
/* If no transition bitmap is provided,
|
||||||
|
* we can use a simplified shader */
|
||||||
if (transMap)
|
if (transMap)
|
||||||
{
|
{
|
||||||
TransShader &shader = gState->transShader();
|
TransShader &shader = gState->transShader();
|
||||||
|
@ -717,12 +720,15 @@ void Graphics::transition(int duration,
|
||||||
else
|
else
|
||||||
gState->sTransShader().setProg(prog);
|
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);
|
FBO::bind(p->transBuffer.fbo);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
p->screenQuad.draw();
|
p->screenQuad.draw();
|
||||||
|
|
||||||
p->checkResize();
|
p->checkResize();
|
||||||
|
|
||||||
|
/* Then blit it flipped and scaled to the screen */
|
||||||
FBO::bind(p->transBuffer.fbo, FBO::Read);
|
FBO::bind(p->transBuffer.fbo, FBO::Read);
|
||||||
p->blitToScreen();
|
p->blitToScreen();
|
||||||
|
|
||||||
|
@ -848,6 +854,7 @@ void Graphics::repaintWait(volatile bool *exitCond)
|
||||||
{
|
{
|
||||||
gState->checkShutdown();
|
gState->checkShutdown();
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
p->blitBufferFlippedScaled();
|
p->blitBufferFlippedScaled();
|
||||||
SDL_GL_SwapWindow(p->threadData->window);
|
SDL_GL_SwapWindow(p->threadData->window);
|
||||||
p->fpsLimiter.delay();
|
p->fpsLimiter.delay();
|
||||||
|
|
Loading…
Reference in New Issue