mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-19 07:51:03 +00:00
and make sure that after vid_restart (or starting the game) it's used correctly in GL3. While at it, made sure that it's *not* applied to textures from gl_nolerp_list, because they're supposed to always use GL_NEAREST independent of this setting (used so console font and crosshairs don't look blurry)
This commit is contained in:
parent
e1ef6e6f35
commit
1077b7525f
4 changed files with 41 additions and 14 deletions
|
@ -216,16 +216,21 @@ R_TextureMode(char *string)
|
|||
ri.Cvar_SetValue("gl_anisotropic", 0.0);
|
||||
}
|
||||
|
||||
const char* nolerplist = gl_nolerp_list->string;
|
||||
|
||||
/* change all the existing mipmap texture objects */
|
||||
for (i = 0, glt = gltextures; i < numgltextures; i++, glt++)
|
||||
{
|
||||
if ((glt->type != it_pic) && (glt->type != it_sky))
|
||||
if (nolerplist != NULL && strstr(nolerplist, glt->name) != NULL)
|
||||
{
|
||||
R_Bind(glt->texnum);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
gl_filter_min);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
gl_filter_max);
|
||||
continue; /* those (by default: font and crosshairs) always only use GL_NEAREST */
|
||||
}
|
||||
|
||||
R_Bind(glt->texnum);
|
||||
if ((glt->type != it_pic) && (glt->type != it_sky)) /* mipmapped texture */
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
|
||||
/* Set anisotropic filter if supported and enabled */
|
||||
if (gl_config.anisotropic && gl_anisotropic->value)
|
||||
|
@ -234,6 +239,13 @@ R_TextureMode(char *string)
|
|||
gl_anisotropic->value);
|
||||
}
|
||||
}
|
||||
else /* texture has no mipmaps */
|
||||
{
|
||||
// we can't use gl_filter_min which might be GL_*_MIPMAP_*
|
||||
// also, there's no anisotropic filtering for textures w/o mipmaps
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ GL3_TextureMode(char *string)
|
|||
|
||||
if (i == num_modes)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "bad filter name\n");
|
||||
R_Printf(PRINT_ALL, "bad filter name '%s' (probably from gl_texturemode)\n", string);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,20 @@ GL3_TextureMode(char *string)
|
|||
|
||||
gl3image_t *glt;
|
||||
|
||||
/* change all the existing mipmap texture objects */
|
||||
const char* nolerplist = gl_nolerp_list->string;
|
||||
|
||||
/* change all the existing texture objects */
|
||||
for (i = 0, glt = gl3textures; i < numgl3textures; i++, glt++)
|
||||
{
|
||||
if ((glt->type != it_pic) && (glt->type != it_sky))
|
||||
if (nolerplist != NULL && strstr(nolerplist, glt->name) != NULL)
|
||||
{
|
||||
continue; /* those (by default: font and crosshairs) always only use GL_NEAREST */
|
||||
}
|
||||
|
||||
GL3_SelectTMU(GL_TEXTURE0);
|
||||
GL3_Bind(glt->texnum);
|
||||
if ((glt->type != it_pic) && (glt->type != it_sky)) /* mipmapped texture */
|
||||
{
|
||||
GL3_SelectTMU(GL_TEXTURE0);
|
||||
GL3_Bind(glt->texnum);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
|
||||
|
@ -106,6 +113,13 @@ GL3_TextureMode(char *string)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_anisotropic->value);
|
||||
}
|
||||
}
|
||||
else /* texture has no mipmaps */
|
||||
{
|
||||
// we can't use gl_filter_min which might be GL_*_MIPMAP_*
|
||||
// also, there's no anisotropic filtering for textures w/o mipmaps
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +208,7 @@ GL3_Upload32(unsigned *data, int width, int height, qboolean mipmap)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
else
|
||||
else // if the texture has no mipmaps, we can't use gl_filter_min which might be GL_*_MIPMAP_*
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
|
|
|
@ -43,8 +43,8 @@ GL3_SetDefaultState(void)
|
|||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
// TODO: gl_texturemode, gl1_texturealphamode?
|
||||
//GL3_TextureMode(gl_texturemode->string);
|
||||
// TODO: gl1_texturealphamode?
|
||||
GL3_TextureMode(gl_texturemode->string);
|
||||
//R_TextureAlphaMode(gl1_texturealphamode->string);
|
||||
//R_TextureSolidMode(gl1_texturesolidmode->string);
|
||||
|
||||
|
|
|
@ -508,6 +508,7 @@ extern cvar_t *vid_gamma;
|
|||
extern cvar_t *gl3_intensity;
|
||||
extern cvar_t *gl3_intensity_2D;
|
||||
extern cvar_t *gl_anisotropic;
|
||||
extern cvar_t *gl_texturemode;
|
||||
|
||||
extern cvar_t *r_lightlevel;
|
||||
extern cvar_t *gl3_overbrightbits;
|
||||
|
|
Loading…
Reference in a new issue