Mipmaps: fix translucent textures turning black

i.e. since we allow texture filtering on translucent textures now, the min filter may specifcy one of the mipmap filters, this means we NEED to call GL_GENERATE_MIPMAP and set the LODs for them, otherwise no texture will be generated
alternatively we could do a bunch of special cases for the mipmap filters, but this is simpler
This commit is contained in:
Alug committed 2025-11-02 14:36:08 +01:00
1 parent 23ba827726
commit 2b7f2da5ee
2 files changed
+11 -7

No files matched your search

-4
View File
@@ -1259,8 +1259,6 @@ static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
case 256:
if (gl_linedef->blendmode)
blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), pSurf);
else
blendmode = PF_Translucent;
break;
default:
if (gl_linedef->blendmode)
@@ -1272,8 +1270,6 @@ static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
}
else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT)
blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), pSurf);
else
blendmode = PF_Masked;
break;
}
}
+11 -3
View File
@@ -2089,7 +2089,7 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
if (MipMap && !(pTexInfo->flags & TF_TRANSPARENT)) // No mipmaps on transparent stuff
if (MipMap)
{
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
@@ -2100,8 +2100,16 @@ void GL_UpdateTexture(GLMipmap_t *pTexInfo)
// Control the mipmap level of detail
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
GenerateMipmaps(w, h, tex, 5, pTexInfo->flags);
if (pTexInfo->flags & TF_TRANSPARENT)
{
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mipmaps on transparent stuff
}
else
{
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
GenerateMipmaps(w, h, tex, 4, pTexInfo->flags);
}
}
else
{