Fixed opengl initialization error when changing and applying graphics settings from UI.

It turns out ui.qvm is compiled with unix opengl driver name - libGL.so.1 which in some scenarios can be assigned to r_glDriver.
Original Q3 handles this by making an attempt to load default driver in case r_glDriver loading error.
Implemented similar logic here.
This commit is contained in:
Artem Kharytoniuk 2018-07-07 15:49:47 +02:00
parent c3ea7fed26
commit 2d62ff47df

View File

@ -734,13 +734,20 @@ void GLimp_Init( void )
ri.Printf( PRINT_ALL, "Initializing OpenGL subsystem\n" );
// load appropriate DLL and initialize subsystem
//
// load the driver and bind our function pointers to it
//
if (!QGL_Init(r_glDriver->string))
{
ri.Error(ERR_FATAL, "QGL_Init - could not load OpenGL driver\n");
}
//
// load the driver and bind our function pointers to it
//
if (!QGL_Init(r_glDriver->string)) {
if (Q_stricmp(r_glDriver->string, OPENGL_DRIVER_NAME)) {
ri.Printf(PRINT_ALL, "...attempting to load default driver: %s\n", OPENGL_DRIVER_NAME);
if (!QGL_Init(OPENGL_DRIVER_NAME)) {
ri.Error(ERR_FATAL, "QGL_Init - could not load OpenGL driver\n");
}
ri.Cvar_Set( "r_glDriver", OPENGL_DRIVER_NAME );
r_glDriver->modified = qfalse;
}
}
SetMode(r_mode->integer, (qboolean)r_fullscreen->integer);