Skip to content
Snippets Groups Projects

Fix OpenGL Fademasks (Screen Transitions)

Merged Sryder requested to merge Sryder/SRB2:gl-fademask-fix into master
+ 26
6
Compare changes
  • Side-by-side
  • Inline
@@ -1470,6 +1470,26 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
else
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
}
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8)
{
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
if (MipMap)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
#ifdef GL_TEXTURE_MIN_LOD
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
#endif
#ifdef GL_TEXTURE_MAX_LOD
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
#endif
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
}
else
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
}
else
{
if (MipMap)
@@ -2143,7 +2163,7 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
@@ -2172,7 +2192,7 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
@@ -2287,22 +2307,22 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
// Bottom left
pglMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f);
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1.0f);
pglVertex3f(-1.0f, -1.0f, 1.0f);
// Top left
pglMultiTexCoord2f(GL_TEXTURE0, 0.0f, yfix);
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1.0f);
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f);
pglVertex3f(-1.0f, 1.0f, 1.0f);
// Top right
pglMultiTexCoord2f(GL_TEXTURE0, xfix, yfix);
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 1.0f);
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 0.0f);
pglVertex3f(1.0f, 1.0f, 1.0f);
// Bottom right
pglMultiTexCoord2f(GL_TEXTURE0, xfix, 0.0f);
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 0.0f);
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 1.0f);
pglVertex3f(1.0f, -1.0f, 1.0f);
pglEnd();
Loading