Replace glBuild2DMipmaps with GL_GENERATE_MIPMAPS

Quote "gluBuild2DMipmaps. Never use this."
gluBuild2DMipmaps was causing massive stutters on many maps on windows
this replaces it with GL_GENERATE_MIPMAP and removes glBuild2DMipmaps completely

https://www.khronos.org/opengl/wiki/Common_Mistakes
This commit is contained in:
Alug 2024-02-01 18:16:24 +01:00 committed by NepDisk
parent 5e5144822e
commit 26304d0bbb
2 changed files with 6 additions and 3 deletions

View file

@ -398,7 +398,6 @@ typedef void (APIENTRY * PFNglCopyTexSubImage2D) (GLenum target, GLint level, GL
static PFNglCopyTexSubImage2D pglCopyTexSubImage2D;
#endif
/* 1.3 functions for multitexturing */
typedef void (APIENTRY *PFNglActiveTexture) (GLenum);
static PFNglActiveTexture pglActiveTexture;
@ -973,7 +972,6 @@ void SetupGLFunc4(void)
*(void**)&pglUniform3fv = GetGLFunc("glUniform3fv");
*(void**)&pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
#endif
}
EXPORT boolean HWRAPI(CompileShaders) (void)
@ -1995,7 +1993,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
{
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else

View file

@ -152,6 +152,11 @@ boolean OglSdlSurface(INT32 w, INT32 h)
else
supportMipMap = false;
if (atof((const char*)gl_version) >= 1.4)
supportMipMap = true;
else
supportMipMap = false;
SetupGLFunc4();
glanisotropicmode_cons_t[1].value = maximumAnisotropy;