Draw: Handle "nolerp" of console characters through a cvar

This commit is contained in:
svdijk 2015-11-24 14:16:18 +01:00
parent 44969748fb
commit 0880bef8c8
2 changed files with 14 additions and 5 deletions

View file

@ -33,14 +33,16 @@ void Scrap_Upload(void);
extern unsigned r_rawpalette[256];
static cvar_t *gl_nolerp_list;
void
Draw_InitLocal(void)
{
/* load console characters (don't bilerp characters) */
/* don't bilerp characters */
gl_nolerp_list = Cvar_Get("gl_nolerp_list", "pics/conchars.pcx", 0);
/* load console characters */
draw_chars = R_FindImage("pics/conchars.pcx", it_pic);
R_Bind(draw_chars->texnum);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
/*

View file

@ -961,6 +961,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
{
image_t *image;
int i;
qboolean nolerp = (strstr(Cvar_VariableString("gl_nolerp_list"), name) != NULL);
/* find a free image_t */
for (i = 0, image = gltextures; i < numgltextures; i++, image++)
@ -1001,7 +1002,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
}
/* load little pics into the scrap */
if ((image->type == it_pic) && (bits == 8) &&
if (!nolerp && (image->type == it_pic) && (bits == 8) &&
(image->width < 64) && (image->height < 64))
{
int x, y;
@ -1078,6 +1079,12 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
image->sh = 1;
image->tl = 0;
image->th = 1;
if (nolerp)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
}
return image;