diff --git a/code/renderer/tr_backend.c b/code/renderer/tr_backend.c index 15e32c5c..30c93685 100644 --- a/code/renderer/tr_backend.c +++ b/code/renderer/tr_backend.c @@ -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 ); 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_WRAP_S, GL_CLAMP ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); } else { if (dirty) { // 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 ); 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_WRAP_S, GL_CLAMP ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); } else { if (dirty) { // otherwise, just subimage upload it so that drivers can tell we are going to be changing diff --git a/code/renderer/tr_bsp.c b/code/renderer/tr_bsp.c index 72e88f35..90aaf9d9 100644 --- a/code/renderer/tr_bsp.c +++ b/code/renderer/tr_bsp.c @@ -205,7 +205,7 @@ static void R_LoadLightmaps( lump_t *l ) { } } 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 ) { diff --git a/code/renderer/tr_font.c b/code/renderer/tr_font.c index 383108fb..bdb4251b 100644 --- a/code/renderer/tr_font.c +++ b/code/renderer/tr_font.c @@ -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); - 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); for (j = lastStart; j < i; j++) { font->glyphs[j].glyph = h; diff --git a/code/renderer/tr_image.c b/code/renderer/tr_image.c index c3828cd1..2c3b72fe 100644 --- a/code/renderer/tr_image.c +++ b/code/renderer/tr_image.c @@ -199,7 +199,7 @@ void R_ImageList_f( void ) { case GL_REPEAT: ri.Printf( PRINT_ALL, "rept " ); break; - case GL_CLAMP: + case GL_CLAMP_TO_EDGE: ri.Printf( PRINT_ALL, "clmp " ); break; default: @@ -1004,7 +1004,7 @@ static void R_CreateDlightImage( void ) { 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 // the border color at the edges. OpenGL 1.2 has clamp-to-edge, which does // 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 ); borderColor[0] = 1.0; @@ -1172,7 +1172,7 @@ void R_CreateBuiltinImages( void ) { for(x=0;x<32;x++) { // 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(); diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index 0da894e0..897d54b9 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -103,7 +103,7 @@ typedef struct image_s { qboolean mipmap; qboolean allowPicmip; - int wrapClampMode; // GL_CLAMP or GL_REPEAT + int wrapClampMode; // GL_CLAMP_TO_EDGE or GL_REPEAT struct image_s* next; } image_t; diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c index 7a44d351..79b8aa01 100644 --- a/code/renderer/tr_shader.c +++ b/code/renderer/tr_shader.c @@ -657,7 +657,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text ) 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] ) { 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++) { Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga" , token, suf[i] ); -#ifdef 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] ) { 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, // 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 ) { ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name ); shader.defaultShader = qtrue;