diff --git a/ref/gl/gl_export.h b/ref/gl/gl_export.h index 7a2acf4c..518337e9 100644 --- a/ref/gl/gl_export.h +++ b/ref/gl/gl_export.h @@ -823,6 +823,8 @@ typedef float GLmatrix[16]; #define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 #define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 diff --git a/ref/gl/gl_opengl.c b/ref/gl/gl_opengl.c index aa9d4fcf..3d810a1b 100644 --- a/ref/gl/gl_opengl.c +++ b/ref/gl/gl_opengl.c @@ -989,6 +989,7 @@ void GL_InitExtensionsBigGL( void ) void GL_InitExtensions( void ) { char value[MAX_VA_STRING]; + GLint major = 0, minor = 0; GL_OnContextCreated(); @@ -1000,11 +1001,26 @@ void GL_InitExtensions( void ) glConfig.renderer_string = (const char *)pglGetString( GL_RENDERER ); glConfig.version_string = (const char *)pglGetString( GL_VERSION ); glConfig.extensions_string = (const char *)pglGetString( GL_EXTENSIONS ); - if( !glConfig.version_major && glConfig.version_string ) + + pglGetIntegerv(GL_MAJOR_VERSION, &major); + pglGetIntegerv(GL_MINOR_VERSION, &minor); + if( !major && glConfig.version_string ) + { + const char *str = glConfig.version_string; + float ver; + + while(*str && (*str < '0' || *str > '9')) str++; + ver = Q_atof(str); + if( ver ) + { + glConfig.version_major = ver; + glConfig.version_minor = (int)(ver * 10) % 10; + } + } + else { - float ver = Q_atof( glConfig.version_string ); - glConfig.version_major = ver; - glConfig.version_major = (int)(ver * 10) % 10; + glConfig.version_major = major; + glConfig.version_minor = minor; } #ifndef XASH_GL_STATIC if( !glConfig.extensions_string )