diff options
author | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-06-13 02:28:51 +0000 |
---|---|---|
committer | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-06-13 02:28:51 +0000 |
commit | 552953540cbb8065160c6670e8655b8d4279c286 (patch) | |
tree | c57a611f1f86b6f12e73b9dc52948e848edf945a /code/sdl | |
parent | a4d1572fe38e3f4dfbdc1f0ee0b203da099a4717 (diff) | |
download | ioquake3-aero-552953540cbb8065160c6670e8655b8d4279c286.tar.gz ioquake3-aero-552953540cbb8065160c6670e8655b8d4279c286.zip |
Added GL_EXT_texture_compression_s3tc support.
GL_S3_s3tc, which Quake 3 previously supported, is legacy. This new codepath
is the common, vendor-neutral extension to get the same results.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1387 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/sdl')
-rw-r--r-- | code/sdl/sdl_glimp.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index c378d5d..f6719a5 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -445,6 +445,17 @@ static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen ) return qtrue; } + +static qboolean GLimp_HaveExtension(const char *ext) +{ + const char *ptr = Q_stristr( glConfig.extensions_string, ext ); + if (ptr == NULL) + return qfalse; + ptr += strlen(ext); + return ((*ptr == ' ') || (*ptr == '\0')); // verify it's complete string. +} + + /* =============== GLimp_InitExtensions @@ -460,29 +471,52 @@ static void GLimp_InitExtensions( void ) ri.Printf( PRINT_ALL, "Initializing OpenGL extensions\n" ); - // GL_S3_s3tc - if ( Q_stristr( glConfig.extensions_string, "GL_S3_s3tc" ) ) + glConfig.textureCompression = TC_NONE; + + // GL_EXT_texture_compression_s3tc + if ( GLimp_HaveExtension( "GL_ARB_texture_compression" ) && + GLimp_HaveExtension( "GL_EXT_texture_compression_s3tc" ) ) { if ( r_ext_compressed_textures->value ) { - glConfig.textureCompression = TC_S3TC; - ri.Printf( PRINT_ALL, "...using GL_S3_s3tc\n" ); + glConfig.textureCompression = TC_S3TC_ARB; + ri.Printf( PRINT_ALL, "...using GL_EXT_texture_compression_s3tc\n" ); } else { - glConfig.textureCompression = TC_NONE; - ri.Printf( PRINT_ALL, "...ignoring GL_S3_s3tc\n" ); + ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_compression_s3tc\n" ); } } else { - glConfig.textureCompression = TC_NONE; - ri.Printf( PRINT_ALL, "...GL_S3_s3tc not found\n" ); + ri.Printf( PRINT_ALL, "...GL_EXT_texture_compression_s3tc not found\n" ); } + // GL_S3_s3tc ... legacy extension before GL_EXT_texture_compression_s3tc. + if (glConfig.textureCompression == TC_NONE) + { + if ( GLimp_HaveExtension( "GL_S3_s3tc" ) ) + { + if ( r_ext_compressed_textures->value ) + { + glConfig.textureCompression = TC_S3TC; + ri.Printf( PRINT_ALL, "...using GL_S3_s3tc\n" ); + } + else + { + ri.Printf( PRINT_ALL, "...ignoring GL_S3_s3tc\n" ); + } + } + else + { + ri.Printf( PRINT_ALL, "...GL_S3_s3tc not found\n" ); + } + } + + // GL_EXT_texture_env_add glConfig.textureEnvAddAvailable = qfalse; - if ( Q_stristr( glConfig.extensions_string, "EXT_texture_env_add" ) ) + if ( GLimp_HaveExtension( "EXT_texture_env_add" ) ) { if ( r_ext_texture_env_add->integer ) { @@ -504,7 +538,7 @@ static void GLimp_InitExtensions( void ) qglMultiTexCoord2fARB = NULL; qglActiveTextureARB = NULL; qglClientActiveTextureARB = NULL; - if ( Q_stristr( glConfig.extensions_string, "GL_ARB_multitexture" ) ) + if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) ) { if ( r_ext_multitexture->value ) { @@ -541,7 +575,7 @@ static void GLimp_InitExtensions( void ) } // GL_EXT_compiled_vertex_array - if ( Q_stristr( glConfig.extensions_string, "GL_EXT_compiled_vertex_array" ) ) + if ( GLimp_HaveExtension( "GL_EXT_compiled_vertex_array" ) ) { if ( r_ext_compiled_vertex_array->value ) { @@ -564,7 +598,7 @@ static void GLimp_InitExtensions( void ) } textureFilterAnisotropic = qfalse; - if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) ) + if ( GLimp_HaveExtension( "GL_EXT_texture_filter_anisotropic" ) ) { if ( r_ext_texture_filter_anisotropic->integer ) { qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy ); |