Browse Source

ref_gl: do not trust REFAPI context version, get it from OpenGL anyway

pull/2/head
mittorn 1 year ago committed by Alibek Omarov
parent
commit
150cbfa4de
  1. 2
      ref/gl/gl_export.h
  2. 24
      ref/gl/gl_opengl.c

2
ref/gl/gl_export.h

@ -823,6 +823,8 @@ typedef float GLmatrix[16]; @@ -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

24
ref/gl/gl_opengl.c

@ -989,6 +989,7 @@ void GL_InitExtensionsBigGL( void ) @@ -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 ) @@ -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 )

Loading…
Cancel
Save