mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-31 21:30:36 +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);
|
ri.Cvar_SetValue("gl_anisotropic", 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* nolerplist = gl_nolerp_list->string;
|
||||||
|
|
||||||
/* change all the existing mipmap texture objects */
|
/* change all the existing mipmap texture objects */
|
||||||
for (i = 0, glt = gltextures; i < numgltextures; i++, glt++)
|
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);
|
continue; /* those (by default: font and crosshairs) always only use GL_NEAREST */
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
}
|
||||||
gl_filter_min);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
R_Bind(glt->texnum);
|
||||||
gl_filter_max);
|
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 */
|
/* Set anisotropic filter if supported and enabled */
|
||||||
if (gl_config.anisotropic && gl_anisotropic->value)
|
if (gl_config.anisotropic && gl_anisotropic->value)
|
||||||
|
@ -234,6 +239,13 @@ R_TextureMode(char *string)
|
||||||
gl_anisotropic->value);
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,13 +90,20 @@ GL3_TextureMode(char *string)
|
||||||
|
|
||||||
gl3image_t *glt;
|
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++)
|
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_MIN_FILTER, gl_filter_min);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
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);
|
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_MIN_FILTER, gl_filter_min);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
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_MIN_FILTER, gl_filter_max);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
// TODO: gl_texturemode, gl1_texturealphamode?
|
// TODO: gl1_texturealphamode?
|
||||||
//GL3_TextureMode(gl_texturemode->string);
|
GL3_TextureMode(gl_texturemode->string);
|
||||||
//R_TextureAlphaMode(gl1_texturealphamode->string);
|
//R_TextureAlphaMode(gl1_texturealphamode->string);
|
||||||
//R_TextureSolidMode(gl1_texturesolidmode->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;
|
||||||
extern cvar_t *gl3_intensity_2D;
|
extern cvar_t *gl3_intensity_2D;
|
||||||
extern cvar_t *gl_anisotropic;
|
extern cvar_t *gl_anisotropic;
|
||||||
|
extern cvar_t *gl_texturemode;
|
||||||
|
|
||||||
extern cvar_t *r_lightlevel;
|
extern cvar_t *r_lightlevel;
|
||||||
extern cvar_t *gl3_overbrightbits;
|
extern cvar_t *gl3_overbrightbits;
|
||||||
|
|
Loading…
Reference in a new issue