From 2a73b7fc9b0a217d3898282419bd4d5703e34003 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 26 Nov 2011 22:41:09 +0000 Subject: [PATCH] Upload sky textures with s wrapping set to GL_CLAMP{_TO_EDGE}. This fixes the vertical (~1 texel wide) stripes that are especially noticable with tiled art skies and Polymost with r_parallaxskyclamp=1 or Polymer (which always uploads skies with repeating s and t coords). What constitutes a sky tile is currently hardcoded to be >=78 and <=99. git-svn-id: https://svn.eduke32.com/eduke32@2141 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymost.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 79902144a..d0b9fca44 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -1122,6 +1122,13 @@ void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt #endif } + +// TODO: make configurable +static int32_t tile_is_sky(int32_t tilenum) +{ + return (tilenum >= 78 /*CLOUDYOCEAN*/ && tilenum <= 99 /*REDSKY2*/); +} + static int32_t gloadtile_art(int32_t dapic, int32_t dapal, int32_t dameth, pthtyp *pth, int32_t doalloc) { coltype *pic, *wpptr; @@ -1230,7 +1237,8 @@ static int32_t gloadtile_art(int32_t dapic, int32_t dapal, int32_t dameth, pthty if (!(dameth&4)) { - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,!tile_is_sky(dapic) ? GL_REPEAT: + (glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP)); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); } else @@ -1871,7 +1879,8 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre if (!(dameth&4)) { - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, !tile_is_sky(dapic) ? GL_REPEAT: + (glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP)); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); } else