diff --git a/Quake/gl_texmgr.c b/Quake/gl_texmgr.c index b8014615..cf43d3e2 100644 --- a/Quake/gl_texmgr.c +++ b/Quake/gl_texmgr.c @@ -981,10 +981,13 @@ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data) { int internalformat, miplevel, mipwidth, mipheight, picmip; - // resample up - data = TexMgr_ResampleTexture (data, glt->width, glt->height, glt->flags & TEXPREF_ALPHA); - glt->width = TexMgr_Pad(glt->width); - glt->height = TexMgr_Pad(glt->height); + if (!gl_texture_NPOT) + { + // resample up + 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 picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int)gl_picmip.value, 0); diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index 81c51ed8..e9b6a515 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -82,6 +82,7 @@ qboolean gl_texture_env_add = false; //johnfitz qboolean gl_swap_control = false; //johnfitz qboolean gl_anisotropy_able = false; //johnfitz float gl_max_anisotropy; //johnfitz +qboolean gl_texture_NPOT = false; //ericw PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz @@ -660,6 +661,21 @@ static void GL_CheckExtensions (void) gl_max_anisotropy = 1; 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"); + } } /* diff --git a/Quake/glquake.h b/Quake/glquake.h index 97818f4d..f1d2bf36 100644 --- a/Quake/glquake.h +++ b/Quake/glquake.h @@ -167,6 +167,10 @@ extern float gl_max_anisotropy; extern qboolean gl_anisotropy_able; //johnfitz +//ericw -- NPOT texture support +extern qboolean gl_texture_NPOT; +//ericw + //johnfitz -- polygon offset #define OFFSET_BMODEL 1 #define OFFSET_NONE 0