Permalink
Browse files

Add GLEW version check and don't try to load core profiles if < 2.0.0.

  • Loading branch information...
gimhael committed Mar 10, 2016
1 parent 03d8826 commit fd3f4b38a46bf0f96b845a680c62c815ced762cb
Showing with 13 additions and 1 deletion.
  1. +13 −1 daemon/src/engine/sys/sdl_glimp.cpp
@@ -488,6 +488,8 @@ static rserr_t GLimp_SetMode( int mode, bool fullscreen, bool noborder )
Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
int x, y;
GLenum glewResult;
int GLmajor, GLminor;
int GLEWmajor, GLEWminor, GLEWmicro;
Log::Notice("Initializing OpenGL display" );
@@ -562,6 +564,12 @@ static rserr_t GLimp_SetMode( int mode, bool fullscreen, bool noborder )
Cvar_Set( "r_customwidth", va("%d", glConfig.vidWidth ) );
Cvar_Set( "r_customheight", va("%d", glConfig.vidHeight ) );
sscanf( ( const char * ) glewGetString( GLEW_VERSION ), "%d.%d.%d",
&GLEWmajor, &GLEWminor, &GLEWmicro );
if( GLEWmajor < 2 ) {
Log::Warn( "GLEW version < 2.0.0 doesn't support GL core profiles" );
}
do
{
if ( glContext != nullptr )
@@ -633,6 +641,9 @@ static rserr_t GLimp_SetMode( int mode, bool fullscreen, bool noborder )
if( testCore && !Q_stricmp(r_glProfile->string, "compat") )
continue;
if( testCore && GLEWmajor < 2 )
continue;
if( !testCore && !Q_stricmp(r_glProfile->string, "core") )
continue;
@@ -735,8 +746,9 @@ static rserr_t GLimp_SetMode( int mode, bool fullscreen, bool noborder )
{
Log::Notice("Using GLEW %s", glewGetString( GLEW_VERSION ) );
}
if( glConfig2.glCoreProfile ) {

This comment has been minimized.

Show comment
Hide comment
@DolceTriade

DolceTriade Mar 10, 2016

Member

This code required?

@DolceTriade

DolceTriade Mar 10, 2016

Member

This code required?

This comment has been minimized.

Show comment
Hide comment
@gimhael

gimhael Mar 10, 2016

Member

no

@gimhael
}
int GLmajor, GLminor;
sscanf( ( const char * ) glGetString( GL_VERSION ), "%d.%d", &GLmajor, &GLminor );
if ( GLmajor < 2 || ( GLmajor == 2 && GLminor < 1 ) )
{

0 comments on commit fd3f4b3

Please sign in to comment.