* s/GL_CLAMP/GL_CLAMP_TO_EDGE/g (If this change appears to cause you problems

and you're using an nVidia graphics card, make sure your 'conformant texture
  clamp' setting is set to on for ioq3)
This commit is contained in:
Tim Angus 2008-08-12 19:34:43 +00:00
parent 7edcc7d16a
commit f2baf359ae
6 changed files with 14 additions and 17 deletions

View file

@ -776,8 +776,8 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data ); qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
} else { } else {
if (dirty) { if (dirty) {
// otherwise, just subimage upload it so that drivers can tell we are going to be changing // otherwise, just subimage upload it so that drivers can tell we are going to be changing
@ -818,8 +818,8 @@ void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data ); qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
} else { } else {
if (dirty) { if (dirty) {
// otherwise, just subimage upload it so that drivers can tell we are going to be changing // otherwise, just subimage upload it so that drivers can tell we are going to be changing

View file

@ -205,7 +205,7 @@ static void R_LoadLightmaps( lump_t *l ) {
} }
} }
tr.lightmaps[i] = R_CreateImage( va("*lightmap%d",i), image, tr.lightmaps[i] = R_CreateImage( va("*lightmap%d",i), image,
LIGHTMAP_SIZE, LIGHTMAP_SIZE, qfalse, qfalse, GL_CLAMP ); LIGHTMAP_SIZE, LIGHTMAP_SIZE, qfalse, qfalse, GL_CLAMP_TO_EDGE );
} }
if ( r_lightmap->integer == 2 ) { if ( r_lightmap->integer == 2 ) {

View file

@ -493,7 +493,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
} }
//Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize); //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
image = R_CreateImage(name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP); image = R_CreateImage(name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP_TO_EDGE);
h = RE_RegisterShaderFromImage(name, LIGHTMAP_2D, image, qfalse); h = RE_RegisterShaderFromImage(name, LIGHTMAP_2D, image, qfalse);
for (j = lastStart; j < i; j++) { for (j = lastStart; j < i; j++) {
font->glyphs[j].glyph = h; font->glyphs[j].glyph = h;

View file

@ -199,7 +199,7 @@ void R_ImageList_f( void ) {
case GL_REPEAT: case GL_REPEAT:
ri.Printf( PRINT_ALL, "rept " ); ri.Printf( PRINT_ALL, "rept " );
break; break;
case GL_CLAMP: case GL_CLAMP_TO_EDGE:
ri.Printf( PRINT_ALL, "clmp " ); ri.Printf( PRINT_ALL, "clmp " );
break; break;
default: default:
@ -1004,7 +1004,7 @@ static void R_CreateDlightImage( void ) {
data[y][x][3] = 255; data[y][x][3] = 255;
} }
} }
tr.dlightImage = R_CreateImage("*dlight", (byte *)data, DLIGHT_SIZE, DLIGHT_SIZE, qfalse, qfalse, GL_CLAMP ); tr.dlightImage = R_CreateImage("*dlight", (byte *)data, DLIGHT_SIZE, DLIGHT_SIZE, qfalse, qfalse, GL_CLAMP_TO_EDGE );
} }
@ -1094,7 +1094,7 @@ static void R_CreateFogImage( void ) {
// standard openGL clamping doesn't really do what we want -- it includes // standard openGL clamping doesn't really do what we want -- it includes
// the border color at the edges. OpenGL 1.2 has clamp-to-edge, which does // the border color at the edges. OpenGL 1.2 has clamp-to-edge, which does
// what we want. // what we want.
tr.fogImage = R_CreateImage("*fog", (byte *)data, FOG_S, FOG_T, qfalse, qfalse, GL_CLAMP ); tr.fogImage = R_CreateImage("*fog", (byte *)data, FOG_S, FOG_T, qfalse, qfalse, GL_CLAMP_TO_EDGE );
ri.Hunk_FreeTempMemory( data ); ri.Hunk_FreeTempMemory( data );
borderColor[0] = 1.0; borderColor[0] = 1.0;
@ -1172,7 +1172,7 @@ void R_CreateBuiltinImages( void ) {
for(x=0;x<32;x++) { for(x=0;x<32;x++) {
// scratchimage is usually used for cinematic drawing // scratchimage is usually used for cinematic drawing
tr.scratchImage[x] = R_CreateImage("*scratch", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, qfalse, qtrue, GL_CLAMP ); tr.scratchImage[x] = R_CreateImage("*scratch", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, qfalse, qtrue, GL_CLAMP_TO_EDGE );
} }
R_CreateDlightImage(); R_CreateDlightImage();

View file

@ -103,7 +103,7 @@ typedef struct image_s {
qboolean mipmap; qboolean mipmap;
qboolean allowPicmip; qboolean allowPicmip;
int wrapClampMode; // GL_CLAMP or GL_REPEAT int wrapClampMode; // GL_CLAMP_TO_EDGE or GL_REPEAT
struct image_s* next; struct image_s* next;
} image_t; } image_t;

View file

@ -657,7 +657,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
return qfalse; return qfalse;
} }
stage->bundle[0].image[0] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_CLAMP ); stage->bundle[0].image[0] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_CLAMP_TO_EDGE );
if ( !stage->bundle[0].image[0] ) if ( !stage->bundle[0].image[0] )
{ {
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name ); ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@ -1230,11 +1230,8 @@ static void ParseSkyParms( char **text ) {
for (i=0 ; i<6 ; i++) { for (i=0 ; i<6 ; i++) {
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga" Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
, token, suf[i] ); , token, suf[i] );
#ifdef GL_CLAMP_TO_EDGE
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_CLAMP_TO_EDGE ); shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_CLAMP_TO_EDGE );
#else
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_CLAMP );
#endif
if ( !shader.sky.outerbox[i] ) { if ( !shader.sky.outerbox[i] ) {
shader.sky.outerbox[i] = tr.defaultImage; shader.sky.outerbox[i] = tr.defaultImage;
} }
@ -2516,7 +2513,7 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
// if not defined in the in-memory shader descriptions, // if not defined in the in-memory shader descriptions,
// look for a single supported image file // look for a single supported image file
// //
image = R_FindImageFile( name, mipRawImage, mipRawImage, mipRawImage ? GL_REPEAT : GL_CLAMP ); image = R_FindImageFile( name, mipRawImage, mipRawImage, mipRawImage ? GL_REPEAT : GL_CLAMP_TO_EDGE );
if ( !image ) { if ( !image ) {
ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name ); ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name );
shader.defaultShader = qtrue; shader.defaultShader = qtrue;