--- quake2/ref_gl/gl_rmain.c 2018/04/24 17:59:26 1.1.1.2 +++ quake2/ref_gl/gl_rmain.c 2018/04/24 18:03:51 1.1.1.3 @@ -1,3 +1,22 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ // r_main.c #include "gl_local.h" @@ -7,6 +26,8 @@ viddef_t vid; refimport_t ri; +int GL_TEXTURE0, GL_TEXTURE1; + model_t *r_worldmodel; float gldepthmin, gldepthmax; @@ -1198,6 +1219,10 @@ int R_Init( void *hinstance, void *hWnd ri.Cvar_Set( "scr_drawall", "0" ); } +#ifdef __linux__ + ri.Cvar_SetValue( "gl_finish", 1 ); +#endif + // MCD has buffering issues if ( gl_config.renderer == GL_RENDERER_MCD ) { @@ -1224,7 +1249,6 @@ int R_Init( void *hinstance, void *hWnd /* ** grab extensions */ -#ifdef WIN32 if ( strstr( gl_config.extensions_string, "GL_EXT_compiled_vertex_array" ) || strstr( gl_config.extensions_string, "GL_SGI_compiled_vertex_array" ) ) { @@ -1237,6 +1261,7 @@ int R_Init( void *hinstance, void *hWnd ri.Con_Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" ); } +#ifdef _WIN32 if ( strstr( gl_config.extensions_string, "WGL_EXT_swap_control" ) ) { qwglSwapIntervalEXT = ( BOOL (WINAPI *)(int)) qwglGetProcAddress( "wglSwapIntervalEXT" ); @@ -1246,6 +1271,7 @@ int R_Init( void *hinstance, void *hWnd { ri.Con_Printf( PRINT_ALL, "...WGL_EXT_swap_control not found\n" ); } +#endif if ( strstr( gl_config.extensions_string, "GL_EXT_point_parameters" ) ) { @@ -1265,8 +1291,29 @@ int R_Init( void *hinstance, void *hWnd ri.Con_Printf( PRINT_ALL, "...GL_EXT_point_parameters not found\n" ); } - if ( strstr( gl_config.extensions_string, "GL_EXT_paletted_texture" ) && - strstr( gl_config.extensions_string, "GL_EXT_shared_texture_palette" ) ) +#ifdef __linux__ + if ( strstr( gl_config.extensions_string, "3DFX_set_global_palette" )) + { + if ( gl_ext_palettedtexture->value ) + { + ri.Con_Printf( PRINT_ALL, "...using 3DFX_set_global_palette\n" ); + qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" ); + qglColorTableEXT = Fake_glColorTableEXT; + } + else + { + ri.Con_Printf( PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); + } + } + else + { + ri.Con_Printf( PRINT_ALL, "...3DFX_set_global_palette not found\n" ); + } +#endif + + if ( !qglColorTableEXT && + strstr( gl_config.extensions_string, "GL_EXT_paletted_texture" ) && + strstr( gl_config.extensions_string, "GL_EXT_shared_texture_palette" ) ) { if ( gl_ext_palettedtexture->value ) { @@ -1283,13 +1330,40 @@ int R_Init( void *hinstance, void *hWnd ri.Con_Printf( PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n" ); } - if ( strstr( gl_config.extensions_string, "GL_SGIS_multitexture" ) ) + if ( strstr( gl_config.extensions_string, "GL_ARB_multitexture" ) ) { if ( gl_ext_multitexture->value ) { + ri.Con_Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" ); + qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMultiTexCoord2fARB" ); + qglActiveTextureARB = ( void * ) qwglGetProcAddress( "glActiveTextureARB" ); + qglClientActiveTextureARB = ( void * ) qwglGetProcAddress( "glClientActiveTextureARB" ); + GL_TEXTURE0 = GL_TEXTURE0_ARB; + GL_TEXTURE1 = GL_TEXTURE1_ARB; + } + else + { + ri.Con_Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" ); + } + } + else + { + ri.Con_Printf( PRINT_ALL, "...GL_ARB_multitexture not found\n" ); + } + + if ( strstr( gl_config.extensions_string, "GL_SGIS_multitexture" ) ) + { + if ( qglActiveTextureARB ) + { + ri.Con_Printf( PRINT_ALL, "...GL_SGIS_multitexture deprecated in favor of ARB_multitexture\n" ); + } + else if ( gl_ext_multitexture->value ) + { ri.Con_Printf( PRINT_ALL, "...using GL_SGIS_multitexture\n" ); qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMTexCoord2fSGIS" ); qglSelectTextureSGIS = ( void * ) qwglGetProcAddress( "glSelectTextureSGIS" ); + GL_TEXTURE0 = GL_TEXTURE0_SGIS; + GL_TEXTURE1 = GL_TEXTURE1_SGIS; } else { @@ -1300,7 +1374,6 @@ int R_Init( void *hinstance, void *hWnd { ri.Con_Printf( PRINT_ALL, "...GL_SGIS_multitexture not found\n" ); } -#endif GL_SetDefaultState();