qt branch: If OpenGL initialization fails, explain to the user why the program does not start. See ticket:2336
parent
60d7cb6127
commit
28624d0c46
|
@ -679,9 +679,7 @@ void WzMainWindow::close()
|
||||||
int wzInit(int argc, char *argv[], int fsaa, bool vsync, int w, int h, bool fullscreen)
|
int wzInit(int argc, char *argv[], int fsaa, bool vsync, int w, int h, bool fullscreen)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
QGL::setPreferredPaintEngine(QPaintEngine::OpenGL); /* Workaround for incorrect text rendering on
|
QGL::setPreferredPaintEngine(QPaintEngine::OpenGL); // Workaround for incorrect text rendering on nany platforms.
|
||||||
* many platforms.
|
|
||||||
*/
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// Setting up OpenGL
|
// Setting up OpenGL
|
||||||
|
@ -698,6 +696,11 @@ int wzInit(int argc, char *argv[], int fsaa, bool vsync, int w, int h, bool full
|
||||||
format.setSamples(fsaa);
|
format.setSamples(fsaa);
|
||||||
}
|
}
|
||||||
WzMainWindow mainwindow(format);
|
WzMainWindow mainwindow(format);
|
||||||
|
if (!mainwindow.context()->isValid())
|
||||||
|
{
|
||||||
|
QMessageBox::critical(NULL, "Oops!", "Warzone2100 failed to create an OpenGL context. This probably means that your graphics drivers are out of date. Try updating them!");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
{
|
{
|
||||||
QDesktopWidget *desktop = qApp->desktop();
|
QDesktopWidget *desktop = qApp->desktop();
|
||||||
|
@ -724,7 +727,7 @@ int wzInit(int argc, char *argv[], int fsaa, bool vsync, int w, int h, bool full
|
||||||
if (finalInitialization() != 0)
|
if (finalInitialization() != 0)
|
||||||
{
|
{
|
||||||
debug(LOG_ERROR, "Failed to carry out final initialization.");
|
debug(LOG_ERROR, "Failed to carry out final initialization.");
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(LOG_MAIN, "Entering main loop");
|
debug(LOG_MAIN, "Entering main loop");
|
||||||
|
|
Loading…
Reference in New Issue