Made a Windows-specific fix for the white screen flashing during startup.

This commit is contained in:
Leon Styhre 2021-03-20 08:52:08 +01:00
parent cd19ef7b16
commit 330a539241

View file

@ -231,7 +231,13 @@ namespace Renderer
setIcon(); setIcon();
setSwapInterval(); setSwapInterval();
// It seems as if Windows needs this to avoid a brief white screen flash on startup.
// Possibly this is driver-specific rather than OS-specific. There is additional code
// in init() to work around the white screen flash issue on all operating systems.
#if defined(_WIN64)
swapBuffers(); swapBuffers();
#endif
#if defined(USE_OPENGL_21) #if defined(USE_OPENGL_21)
LOG(LogInfo) << "Loading shaders..."; LOG(LogInfo) << "Loading shaders...";
@ -338,7 +344,7 @@ namespace Renderer
setViewport(viewport); setViewport(viewport);
setProjection(projection); setProjection(projection);
// This is required to avoid a brief white screen flash seen on some systems. // This is required to avoid a brief white screen flash during startup on some systems.
Renderer::drawRect(0.0f, 0.0f, static_cast<float>(Renderer::getScreenWidth()), Renderer::drawRect(0.0f, 0.0f, static_cast<float>(Renderer::getScreenWidth()),
static_cast<float>(Renderer::getScreenHeight()), 0x000000FF, 0x000000FF); static_cast<float>(Renderer::getScreenHeight()), 0x000000FF, 0x000000FF);
swapBuffers(); swapBuffers();