support for GL_ARB_texture_non_power_of_two, patch from Eric Wasylishen.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@931 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2014-07-11 06:56:09 +00:00
parent 4becf0b399
commit 75338a37a1
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;
// 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);

View File

@ -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");
}
}
/*

View File

@ -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