Handle failure of OpenGL context creation (#2172)

This commit is contained in:
Gess1t
2024-10-27 09:20:51 +01:00
committed by GitHub
parent 2d561a60c8
commit 2bf0eb7ead
2 changed files with 13 additions and 9 deletions

View File

@ -841,7 +841,15 @@ void MainWindow::createScreenPanel()
panel = panelGL;
panelGL->createContext();
// Check that creating the context hasn't failed
if (panelGL->createContext() == false)
{
Log(LogLevel::Error, "Failed to create OpenGL context, falling back to Software Renderer.\n");
hasOGL = false;
globalCfg.SetBool("Screen.UseGL", false);
globalCfg.SetInt("3D.Renderer", renderer3D_Software);
}
}
if (!hasOGL)