1
0
Fork 0
forked from fte/fteqw

Fixed non-square dds images.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3242 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-07-07 06:34:07 +00:00
parent 670b45edd9
commit c021324009

View file

@ -1827,6 +1827,7 @@ int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
int datasize;
int intfmt;
int pad;
unsigned int w, h;
ddsheader fmtheader;
if (*(int*)buffer != *(int*)"DDS ")
@ -1873,7 +1874,13 @@ int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
// (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
if (datasize < pad)
datasize = pad;
qglCompressedTexImage2DARB(GL_TEXTURE_2D, mipnum, intfmt, fmtheader.dwWidth>>mipnum, fmtheader.dwHeight>>mipnum, 0, datasize, buffer);
w = fmtheader.dwWidth>>mipnum;
if (w < 1)
w = 1;
h = fmtheader.dwHeight>>mipnum;
if (h < 1)
h = 1;
qglCompressedTexImage2DARB(GL_TEXTURE_2D, mipnum, intfmt, w, h, 0, datasize, buffer);
if (qglGetError())
Con_Printf("Incompatible dds file (mip %i)\n", mipnum);
buffer += datasize;