mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 14:52:00 +00:00
* Remove use of GL_ARB_multitexture since this has been part of the
core API for many years now
This commit is contained in:
parent
d6f32df425
commit
4f4f0c0dab
9 changed files with 42 additions and 84 deletions
|
@ -28,10 +28,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#include "SDL_opengl.h"
|
||||
|
||||
extern PFNGLMULTITEXCOORD2FARBPROC qglMultiTexCoord2fARB;
|
||||
extern PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB;
|
||||
extern PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB;
|
||||
|
||||
extern PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
|
||||
extern PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
|
||||
|
||||
|
@ -371,5 +367,23 @@ extern PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
|
|||
#define qglVertex4sv glVertex4sv
|
||||
#define qglVertexPointer glVertexPointer
|
||||
#define qglViewport glViewport
|
||||
#define qglMultiTexCoord1s glMultiTexCoord1s
|
||||
#define qglMultiTexCoord1i glMultiTexCoord1i
|
||||
#define qglMultiTexCoord1f glMultiTexCoord1f
|
||||
#define qglMultiTexCoord1d glMultiTexCoord1d
|
||||
#define qglMultiTexCoord2s glMultiTexCoord2s
|
||||
#define qglMultiTexCoord2i glMultiTexCoord2i
|
||||
#define qglMultiTexCoord2f glMultiTexCoord2f
|
||||
#define qglMultiTexCoord2d glMultiTexCoord2d
|
||||
#define qglMultiTexCoord3s glMultiTexCoord3s
|
||||
#define qglMultiTexCoord3i glMultiTexCoord3i
|
||||
#define qglMultiTexCoord3f glMultiTexCoord3f
|
||||
#define qglMultiTexCoord3d glMultiTexCoord3d
|
||||
#define qglMultiTexCoord4s glMultiTexCoord4s
|
||||
#define qglMultiTexCoord4i glMultiTexCoord4i
|
||||
#define qglMultiTexCoord4f glMultiTexCoord4f
|
||||
#define qglMultiTexCoord4d glMultiTexCoord4d
|
||||
#define qglActiveTexture glActiveTexture
|
||||
#define qglClientActiveTexture glClientActiveTexture
|
||||
|
||||
#endif
|
||||
|
|
|
@ -71,17 +71,17 @@ void GL_SelectTexture( int unit )
|
|||
|
||||
if ( unit == 0 )
|
||||
{
|
||||
qglActiveTextureARB( GL_TEXTURE0_ARB );
|
||||
GLimp_LogComment( "glActiveTextureARB( GL_TEXTURE0_ARB )\n" );
|
||||
qglClientActiveTextureARB( GL_TEXTURE0_ARB );
|
||||
GLimp_LogComment( "glClientActiveTextureARB( GL_TEXTURE0_ARB )\n" );
|
||||
qglActiveTexture( GL_TEXTURE0 );
|
||||
GLimp_LogComment( "glActiveTexture( GL_TEXTURE0 )\n" );
|
||||
qglClientActiveTexture( GL_TEXTURE0 );
|
||||
GLimp_LogComment( "glClientActiveTexture( GL_TEXTURE0 )\n" );
|
||||
}
|
||||
else if ( unit == 1 )
|
||||
{
|
||||
qglActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
GLimp_LogComment( "glActiveTextureARB( GL_TEXTURE1_ARB )\n" );
|
||||
qglClientActiveTextureARB( GL_TEXTURE1_ARB );
|
||||
GLimp_LogComment( "glClientActiveTextureARB( GL_TEXTURE1_ARB )\n" );
|
||||
qglActiveTexture( GL_TEXTURE1 );
|
||||
GLimp_LogComment( "glActiveTexture( GL_TEXTURE1 )\n" );
|
||||
qglClientActiveTexture( GL_TEXTURE1 );
|
||||
GLimp_LogComment( "glClientActiveTexture( GL_TEXTURE1 )\n" );
|
||||
} else {
|
||||
ri.Error( ERR_DROP, "GL_SelectTexture: unit = %i", unit );
|
||||
}
|
||||
|
|
|
@ -765,13 +765,13 @@ image_t *R_CreateImage( const char *name, const byte *pic, int width, int height
|
|||
image->wrapClampMode = glWrapClampMode;
|
||||
|
||||
// lightmaps are always allocated on TMU 1
|
||||
if ( qglActiveTextureARB && isLightmap ) {
|
||||
if ( glConfig.numTextureUnits > 1 && isLightmap ) {
|
||||
image->TMU = 1;
|
||||
} else {
|
||||
image->TMU = 0;
|
||||
}
|
||||
|
||||
if ( qglActiveTextureARB ) {
|
||||
if ( glConfig.numTextureUnits > 1 ) {
|
||||
GL_SelectTexture( image->TMU );
|
||||
}
|
||||
|
||||
|
@ -4849,7 +4849,7 @@ void R_DeleteTextures( void ) {
|
|||
tr.numImages = 0;
|
||||
|
||||
Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
|
||||
if ( qglActiveTextureARB ) {
|
||||
if ( glConfig.numTextureUnits > 1 ) {
|
||||
GL_SelectTexture( 1 );
|
||||
qglBindTexture( GL_TEXTURE_2D, 0 );
|
||||
GL_SelectTexture( 0 );
|
||||
|
|
|
@ -80,8 +80,6 @@ cvar_t *r_nocurves;
|
|||
cvar_t *r_allowExtensions;
|
||||
|
||||
cvar_t *r_ext_compressed_textures;
|
||||
cvar_t *r_ext_gamma_control;
|
||||
cvar_t *r_ext_multitexture;
|
||||
cvar_t *r_ext_compiled_vertex_array;
|
||||
cvar_t *r_ext_texture_env_add;
|
||||
cvar_t *r_ext_texture_filter_anisotropic;
|
||||
|
@ -761,7 +759,7 @@ void GL_SetDefaultState( void )
|
|||
|
||||
// initialize downstream texture unit if we're running
|
||||
// in a multitexture environment
|
||||
if ( qglActiveTextureARB ) {
|
||||
if ( glConfig.numTextureUnits > 1 ) {
|
||||
GL_SelectTexture( 1 );
|
||||
GL_TextureMode( r_textureMode->string );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
@ -801,7 +799,6 @@ GfxInfo_f
|
|||
*/
|
||||
void GfxInfo_f( void )
|
||||
{
|
||||
cvar_t *sys_cpustring = ri.Cvar_Get( "sys_cpustring", "", 0 );
|
||||
const char *enablestrings[] =
|
||||
{
|
||||
"disabled",
|
||||
|
@ -818,7 +815,7 @@ void GfxInfo_f( void )
|
|||
ri.Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string );
|
||||
ri.Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
||||
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
|
||||
ri.Printf( PRINT_ALL, "GL_MAX_ACTIVE_TEXTURES_ARB: %d\n", glConfig.maxActiveTextures );
|
||||
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS: %d\n", glConfig.numTextureUnits );
|
||||
ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );
|
||||
ri.Printf( PRINT_ALL, "MODE: %d, %d x %d %s hz:", r_mode->integer, glConfig.vidWidth, glConfig.vidHeight, fsstrings[r_fullscreen->integer == 1] );
|
||||
if ( glConfig.displayFrequency )
|
||||
|
@ -837,7 +834,6 @@ void GfxInfo_f( void )
|
|||
{
|
||||
ri.Printf( PRINT_ALL, "GAMMA: software w/ %d overbright bits\n", tr.overbrightBits );
|
||||
}
|
||||
ri.Printf( PRINT_ALL, "CPU: %s\n", sys_cpustring->string );
|
||||
|
||||
// rendering primitives
|
||||
{
|
||||
|
@ -867,7 +863,7 @@ void GfxInfo_f( void )
|
|||
ri.Printf( PRINT_ALL, "texturemode: %s\n", r_textureMode->string );
|
||||
ri.Printf( PRINT_ALL, "picmip: %d\n", r_picmip->integer );
|
||||
ri.Printf( PRINT_ALL, "texture bits: %d\n", r_texturebits->integer );
|
||||
ri.Printf( PRINT_ALL, "multitexture: %s\n", enablestrings[qglActiveTextureARB != 0] );
|
||||
ri.Printf( PRINT_ALL, "multitexture: %s\n", enablestrings[glConfig.numTextureUnits > 1] );
|
||||
ri.Printf( PRINT_ALL, "compiled vertex arrays: %s\n", enablestrings[qglLockArraysEXT != 0 ] );
|
||||
ri.Printf( PRINT_ALL, "texenv add: %s\n", enablestrings[glConfig.textureEnvAddAvailable != 0] );
|
||||
ri.Printf( PRINT_ALL, "compressed textures: %s\n", enablestrings[glConfig.textureCompression!=TC_NONE] );
|
||||
|
@ -903,14 +899,8 @@ void R_Register( void )
|
|||
//
|
||||
r_allowExtensions = ri.Cvar_Get( "r_allowExtensions", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_ext_compressed_textures = ri.Cvar_Get( "r_ext_compressed_textures", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_ext_gamma_control = ri.Cvar_Get( "r_ext_gamma_control", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_ext_multitexture = ri.Cvar_Get( "r_ext_multitexture", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_ext_compiled_vertex_array = ri.Cvar_Get( "r_ext_compiled_vertex_array", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
#ifdef __linux__ // broken on linux
|
||||
r_ext_texture_env_add = ri.Cvar_Get( "r_ext_texture_env_add", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
#else
|
||||
r_ext_texture_env_add = ri.Cvar_Get( "r_ext_texture_env_add", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
#endif
|
||||
|
||||
r_ext_texture_filter_anisotropic = ri.Cvar_Get( "r_ext_texture_filter_anisotropic",
|
||||
"0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
@ -924,11 +914,7 @@ void R_Register( void )
|
|||
r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_colorbits = ri.Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_stereo = ri.Cvar_Get( "r_stereo", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
#ifdef __linux__
|
||||
r_stencilbits = ri.Cvar_Get( "r_stencilbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
#else
|
||||
r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
#endif
|
||||
r_depthbits = ri.Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
|
|
@ -1041,9 +1041,6 @@ extern cvar_t *r_ignorehwgamma; // overrides hardware gamma capabilities
|
|||
|
||||
extern cvar_t *r_allowExtensions; // global enable/disable of OpenGL extensions
|
||||
extern cvar_t *r_ext_compressed_textures; // these control use of specific extensions
|
||||
extern cvar_t *r_ext_gamma_control;
|
||||
extern cvar_t *r_ext_texenv_op;
|
||||
extern cvar_t *r_ext_multitexture;
|
||||
extern cvar_t *r_ext_compiled_vertex_array;
|
||||
extern cvar_t *r_ext_texture_env_add;
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ This is just for OpenGL conformance testing, it should never be the fastest
|
|||
static void APIENTRY R_ArrayElementDiscrete( GLint index ) {
|
||||
qglColor4ubv( tess.svars.colors[ index ] );
|
||||
if ( glState.currenttmu ) {
|
||||
qglMultiTexCoord2fARB( 0, tess.svars.texcoords[ 0 ][ index ][0], tess.svars.texcoords[ 0 ][ index ][1] );
|
||||
qglMultiTexCoord2fARB( 1, tess.svars.texcoords[ 1 ][ index ][0], tess.svars.texcoords[ 1 ][ index ][1] );
|
||||
qglMultiTexCoord2f( 0, tess.svars.texcoords[ 0 ][ index ][0], tess.svars.texcoords[ 0 ][ index ][1] );
|
||||
qglMultiTexCoord2f( 1, tess.svars.texcoords[ 1 ][ index ][0], tess.svars.texcoords[ 1 ][ index ][1] );
|
||||
} else {
|
||||
qglTexCoord2fv( tess.svars.texcoords[ 0 ][ index ] );
|
||||
}
|
||||
|
|
|
@ -1761,7 +1761,7 @@ static qboolean CollapseMultitexture( void ) {
|
|||
int i;
|
||||
textureBundle_t tmpBundle;
|
||||
|
||||
if ( !qglActiveTextureARB ) {
|
||||
if ( glConfig.numTextureUnits < 2 ) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ typedef struct {
|
|||
char extensions_string[BIG_INFO_STRING];
|
||||
|
||||
int maxTextureSize; // queried from GL
|
||||
int maxActiveTextures; // multitexture ability
|
||||
int numTextureUnits; // multitexture ability
|
||||
|
||||
int colorBits, depthBits, stencilBits;
|
||||
|
||||
|
|
|
@ -70,10 +70,6 @@ static SDL_Surface *screen = NULL;
|
|||
|
||||
cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained
|
||||
|
||||
PFNGLMULTITEXCOORD2FARBPROC qglMultiTexCoord2fARB;
|
||||
PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB;
|
||||
PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB;
|
||||
|
||||
PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
|
||||
PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
|
||||
|
||||
|
@ -380,46 +376,6 @@ static void GLimp_InitExtensions( void )
|
|||
ri.Printf( PRINT_ALL, "...GL_EXT_texture_env_add not found\n" );
|
||||
}
|
||||
|
||||
// GL_ARB_multitexture
|
||||
qglMultiTexCoord2fARB = NULL;
|
||||
qglActiveTextureARB = NULL;
|
||||
qglClientActiveTextureARB = NULL;
|
||||
if ( Q_stristr( glConfig.extensions_string, "GL_ARB_multitexture" ) )
|
||||
{
|
||||
if ( r_ext_multitexture->value )
|
||||
{
|
||||
qglMultiTexCoord2fARB = ( PFNGLMULTITEXCOORD2FARBPROC ) SDL_GL_GetProcAddress( "glMultiTexCoord2fARB" );
|
||||
qglActiveTextureARB = ( PFNGLACTIVETEXTUREARBPROC ) SDL_GL_GetProcAddress( "glActiveTextureARB" );
|
||||
qglClientActiveTextureARB = ( PFNGLCLIENTACTIVETEXTUREARBPROC ) SDL_GL_GetProcAddress( "glClientActiveTextureARB" );
|
||||
|
||||
if ( qglActiveTextureARB )
|
||||
{
|
||||
GLint glint = 0;
|
||||
qglGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &glint );
|
||||
glConfig.maxActiveTextures = (int) glint;
|
||||
if ( glConfig.maxActiveTextures > 1 )
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
qglMultiTexCoord2fARB = NULL;
|
||||
qglActiveTextureARB = NULL;
|
||||
qglClientActiveTextureARB = NULL;
|
||||
ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "...GL_ARB_multitexture not found\n" );
|
||||
}
|
||||
|
||||
// GL_EXT_compiled_vertex_array
|
||||
if ( Q_stristr( glConfig.extensions_string, "GL_EXT_compiled_vertex_array" ) )
|
||||
{
|
||||
|
@ -490,7 +446,7 @@ void GLimp_Init( void )
|
|||
{
|
||||
if( r_mode->integer != R_MODE_FALLBACK )
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d",
|
||||
ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d\n",
|
||||
r_mode->integer, R_MODE_FALLBACK );
|
||||
if( !GLimp_StartDriverAndSetMode( R_MODE_FALLBACK, r_fullscreen->integer ) )
|
||||
success = qfalse;
|
||||
|
@ -515,6 +471,11 @@ void GLimp_Init( void )
|
|||
Q_strncpyz( glConfig.version_string, (char *) qglGetString (GL_VERSION), sizeof( glConfig.version_string ) );
|
||||
Q_strncpyz( glConfig.extensions_string, (char *) qglGetString (GL_EXTENSIONS), sizeof( glConfig.extensions_string ) );
|
||||
|
||||
// multitexturing
|
||||
qglGetIntegerv( GL_MAX_TEXTURE_UNITS, (GLint *)&glConfig.numTextureUnits );
|
||||
if( glConfig.numTextureUnits < 2 )
|
||||
ri.Printf( PRINT_ALL, "Insufficient texture units for multitexturing\n" );
|
||||
|
||||
// initialize extensions
|
||||
GLimp_InitExtensions( );
|
||||
|
||||
|
|
Loading…
Reference in a new issue