From 2d62ff47df207f7f9593622f3f3b9322fbfa81e6 Mon Sep 17 00:00:00 2001 From: Artem Kharytoniuk Date: Sat, 7 Jul 2018 15:49:47 +0200 Subject: [PATCH] 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. --- src/engine/platform/win_glimp.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/engine/platform/win_glimp.c b/src/engine/platform/win_glimp.c index 70e764a..c15c306 100644 --- a/src/engine/platform/win_glimp.c +++ b/src/engine/platform/win_glimp.c @@ -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);