support for GL_ARB_texture_non_power_of_two, patch from Eric Wasylishen.

git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@931 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2014-07-11 06:56:09 +00:00
parent 88437cd8b1
commit b99a7ea72a
3 changed files with 27 additions and 4 deletions

View file

@ -981,10 +981,13 @@ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
{ {
int internalformat, miplevel, mipwidth, mipheight, picmip; int internalformat, miplevel, mipwidth, mipheight, picmip;
// resample up if (!gl_texture_NPOT)
data = TexMgr_ResampleTexture (data, glt->width, glt->height, glt->flags & TEXPREF_ALPHA); {
glt->width = TexMgr_Pad(glt->width); // resample up
glt->height = TexMgr_Pad(glt->height); data = TexMgr_ResampleTexture (data, glt->width, glt->height, glt->flags & TEXPREF_ALPHA);
glt->width = TexMgr_Pad(glt->width);
glt->height = TexMgr_Pad(glt->height);
}
// mipmap down // mipmap down
picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int)gl_picmip.value, 0); picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int)gl_picmip.value, 0);

View file

@ -82,6 +82,7 @@ qboolean gl_texture_env_add = false; //johnfitz
qboolean gl_swap_control = false; //johnfitz qboolean gl_swap_control = false; //johnfitz
qboolean gl_anisotropy_able = false; //johnfitz qboolean gl_anisotropy_able = false; //johnfitz
float gl_max_anisotropy; //johnfitz float gl_max_anisotropy; //johnfitz
qboolean gl_texture_NPOT = false; //ericw
PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz
PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz
@ -660,6 +661,21 @@ static void GL_CheckExtensions (void)
gl_max_anisotropy = 1; gl_max_anisotropy = 1;
Con_Warning ("texture_filter_anisotropic not supported\n"); Con_Warning ("texture_filter_anisotropic not supported\n");
} }
//
// texture_non_power_of_two
//
if (COM_CheckParm("-notexturenpot"))
Con_Warning ("texture_non_power_of_two disabled at command line\n");
else if (GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_non_power_of_two"))
{
Con_Printf("FOUND: GL_ARB_texture_non_power_of_two\n");
gl_texture_NPOT = true;
}
else
{
Con_Warning ("texture_non_power_of_two not supported\n");
}
} }
/* /*

View file

@ -167,6 +167,10 @@ extern float gl_max_anisotropy;
extern qboolean gl_anisotropy_able; extern qboolean gl_anisotropy_able;
//johnfitz //johnfitz
//ericw -- NPOT texture support
extern qboolean gl_texture_NPOT;
//ericw
//johnfitz -- polygon offset //johnfitz -- polygon offset
#define OFFSET_BMODEL 1 #define OFFSET_BMODEL 1
#define OFFSET_NONE 0 #define OFFSET_NONE 0