diff options
| author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2006-04-22 22:14:15 +0000 | 
|---|---|---|
| committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2006-04-22 22:14:15 +0000 | 
| commit | 005094d39f4371eb7fa09671ab6b067c0caf0c22 (patch) | |
| tree | 3ce1bfcd93ba4324d75ee8ca149d0cf190cbe8e0 /code | |
| parent | 5aa090003b6c47a4d10f11975d7f22a2827956b0 (diff) | |
| download | ioquake3-aero-005094d39f4371eb7fa09671ab6b067c0caf0c22.tar.gz ioquake3-aero-005094d39f4371eb7fa09671ab6b067c0caf0c22.zip  | |
* Anisotropic texture filtering (from Echon)
git-svn-id: svn://svn.icculus.org/quake3/trunk@719 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
| -rw-r--r-- | code/renderer/tr_image.c | 7 | ||||
| -rw-r--r-- | code/renderer/tr_init.c | 6 | ||||
| -rw-r--r-- | code/renderer/tr_local.h | 3 | ||||
| -rw-r--r-- | code/renderer/tr_types.h | 3 | ||||
| -rw-r--r-- | code/unix/linux_glimp.c | 24 | ||||
| -rw-r--r-- | code/unix/sdl_glimp.c | 24 | ||||
| -rw-r--r-- | code/win32/win_glimp.c | 25 | 
7 files changed, 92 insertions, 0 deletions
diff --git a/code/renderer/tr_image.c b/code/renderer/tr_image.c index c227388..88d0ec2 100644 --- a/code/renderer/tr_image.c +++ b/code/renderer/tr_image.c @@ -699,11 +699,18 @@ done:  	if (mipmap)  	{ +		if ( glConfig.textureFilterAnisotropic ) +			qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, +					(GLint)Com_Clamp( 1, glConfig.maxAnisotropy, r_ext_max_anisotropy->integer ) ); +  		qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);  		qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);  	}  	else  	{ +		if ( glConfig.textureFilterAnisotropic ) +			qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 ); +  		qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );  		qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );  	} diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c index bf234b4..7300978 100644 --- a/code/renderer/tr_init.c +++ b/code/renderer/tr_init.c @@ -81,6 +81,8 @@ 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; +cvar_t	*r_ext_max_anisotropy;  cvar_t	*r_ignoreGLErrors;  cvar_t	*r_logFile; @@ -910,6 +912,10 @@ void R_Register( void )  	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 ); +	r_ext_max_anisotropy = ri.Cvar_Get( "r_ext_max_anisotropy", "2", CVAR_ARCHIVE | CVAR_LATCH ); +  	r_picmip = ri.Cvar_Get ("r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH );  	r_roundImagesDown = ri.Cvar_Get ("r_roundImagesDown", "1", CVAR_ARCHIVE | CVAR_LATCH );  	r_colorMipLevels = ri.Cvar_Get ("r_colorMipLevels", "0", CVAR_LATCH ); diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index 0fecbcd..6fe7ee9 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -1041,6 +1041,9 @@ extern cvar_t	*r_ext_multitexture;  extern cvar_t	*r_ext_compiled_vertex_array;  extern cvar_t	*r_ext_texture_env_add; +extern cvar_t	*r_ext_texture_filter_anisotropic; +extern cvar_t	*r_ext_max_anisotropy; +  extern	cvar_t	*r_nobind;						// turns off binding to appropriate textures  extern	cvar_t	*r_singleShader;				// make most world faces use default shader  extern	cvar_t	*r_roundImagesDown; diff --git a/code/renderer/tr_types.h b/code/renderer/tr_types.h index 12b526e..4ed880a 100644 --- a/code/renderer/tr_types.h +++ b/code/renderer/tr_types.h @@ -200,6 +200,9 @@ typedef struct {  	qboolean				isFullscreen;  	qboolean				stereoEnabled;  	qboolean				smpActive;		// dual processor + +	qboolean				textureFilterAnisotropic; +	int						maxAnisotropy;  } glconfig_t;  // FIXME: VM should be OS agnostic .. in theory diff --git a/code/unix/linux_glimp.c b/code/unix/linux_glimp.c index 44ffeb3..16a0eda 100644 --- a/code/unix/linux_glimp.c +++ b/code/unix/linux_glimp.c @@ -1323,6 +1323,30 @@ static void GLW_InitExtensions( void )      ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" );    } +  glConfig.textureFilterAnisotropic = qfalse; +  if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) ) +  { +    if ( r_ext_texture_filter_anisotropic->integer ) { +      qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxAnisotropy ); +      if ( glConfig.maxAnisotropy <= 0 ) { +        ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" ); +        glConfig.maxAnisotropy = 0; +      } +      else +      { +        ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", glConfig.maxAnisotropy ); +        glConfig.textureFilterAnisotropic = qtrue; +      } +    } +    else +    { +      ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" ); +    } +  } +  else +  { +    ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" ); +  }  }  static void GLW_InitGamma(void) diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c index 771bb23..0c6f8dc 100644 --- a/code/unix/sdl_glimp.c +++ b/code/unix/sdl_glimp.c @@ -802,6 +802,30 @@ static void GLW_InitExtensions( void )      ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" );    } +  glConfig.textureFilterAnisotropic = qfalse; +  if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) ) +  { +    if ( r_ext_texture_filter_anisotropic->integer ) { +      qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxAnisotropy ); +      if ( glConfig.maxAnisotropy <= 0 ) { +        ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" ); +        glConfig.maxAnisotropy = 0; +      } +      else +      { +        ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", glConfig.maxAnisotropy ); +        glConfig.textureFilterAnisotropic = qtrue; +      } +    } +    else +    { +      ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" ); +    } +  } +  else +  { +    ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" ); +  }  }  static void GLW_InitGamma( void ) diff --git a/code/win32/win_glimp.c b/code/win32/win_glimp.c index 4f97f04..f9b1289 100644 --- a/code/win32/win_glimp.c +++ b/code/win32/win_glimp.c @@ -1111,6 +1111,31 @@ static void GLW_InitExtensions( void )  	{  		ri.Printf( PRINT_ALL, "...WGL_3DFX_gamma_control not found\n" );  	} + +	glConfig.textureFilterAnisotropic = qfalse; +	if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) ) +	{ +		if ( r_ext_texture_filter_anisotropic->integer ) { +			qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxAnisotropy ); +			if ( glConfig.maxAnisotropy <= 0 ) { +				ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" ); +				glConfig.maxAnisotropy = 0; +			} +			else +			{ +				ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", glConfig.maxAnisotropy ); +				glConfig.textureFilterAnisotropic = qtrue; +			} +		} +		else +		{ +			ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" ); +		} +	} +	else +	{ +		ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" ); +	}  }  /*  | 
