Skip to content

Commit

Permalink
Fix occasional filtering artifacts for HUD/menu graphics (Shpoike#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler authored and timbergeron committed Aug 13, 2023
1 parent b40bb03 commit 69b82a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Quake/gl_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ qpic_t *Draw_TryCachePic (const char *path, unsigned int texflags)

//Spike -- if we're loading external images, and one exists, then use that instead (but with the sizes of the lmp).
COM_StripExtension(path, newname, sizeof(newname));
if (draw_load24bit && (gl.gltexture=TexMgr_LoadImage (NULL, path, 0, 0, SRC_EXTERNAL, NULL, newname, 0, texflags|TEXPREF_MIPMAP|TEXPREF_ALLOWMISSING)))
if (draw_load24bit && (gl.gltexture=TexMgr_LoadImage (NULL, path, 0, 0, SRC_EXTERNAL, NULL, newname, 0, texflags|TEXPREF_MIPMAP|TEXPREF_ALLOWMISSING|TEXPREF_CLAMP))) // woods iw add clamp
{
gl.sl = 0;
gl.sh = (texflags&TEXPREF_PAD)?(float)gl.gltexture->source_width/(float)TexMgr_PadConditional(gl.gltexture->source_width):1;
Expand All @@ -390,7 +390,7 @@ qpic_t *Draw_TryCachePic (const char *path, unsigned int texflags)
else
{
gl.gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path,
sizeof(int)*2, texflags | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
sizeof(int)*2, texflags | TEXPREF_NOPICMIP | TEXPREF_CLAMP); //johnfitz -- TexMgr -- woods iw add clamp
gl.sl = 0;
gl.sh = (texflags&TEXPREF_PAD)?(float)dat->width/(float)TexMgr_PadConditional(dat->width):1; //johnfitz
gl.tl = 0;
Expand Down
6 changes: 6 additions & 0 deletions Quake/gl_texmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ static void TexMgr_SetFilterModes (gltexture_t *glt)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmodes[glmode_idx].magfilter);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glmodes[glmode_idx].magfilter);
}

if (glt->flags & TEXPREF_CLAMP) // woods iw clamp
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
}

/*
Expand Down
1 change: 1 addition & 0 deletions Quake/gl_texmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TEXPREF_PREMULTIPLY 0x1000 // rgb = rgb*a; a=a;
#define TEXPREF_ALLOWMISSING 0x2000 // TexMgr_LoadImage should return NULL if anything goes wrong (for use with SRC_EXTERNAL).
#define TEXPREF_COLOURMAPPED 0x4000 // internal - this texture has at least one recoloured variant that needs cleaning up on destruction.
#define TEXPREF_CLAMP 0x8000 // clamp UVs -- woods iw clamp

enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA, SRC_EXTERNAL, SRC_FIRSTCOMPRESSED};
extern qboolean gl_texture_s3tc, gl_texture_rgtc, gl_texture_bptc, gl_texture_etc2, gl_texture_astc, gl_texture_e5bgr9;
Expand Down

0 comments on commit 69b82a8

Please sign in to comment.