diff options
Diffstat (limited to 'progs/util/readtex.c')
-rw-r--r-- | progs/util/readtex.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/progs/util/readtex.c b/progs/util/readtex.c index e741ba5ae1..d9a5dc78f5 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -267,6 +267,15 @@ static void FreeImage( TK_RGBImageRec *image ) */ GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) { + GLint w, h; + return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h ); +} + + + +GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ) +{ GLint error; GLenum format; TK_RGBImageRec *image; @@ -290,14 +299,18 @@ GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) return GL_FALSE; } - error = gluBuild2DMipmaps( GL_TEXTURE_2D, + error = gluBuild2DMipmaps( target, intFormat, image->sizeX, image->sizeY, format, GL_UNSIGNED_BYTE, image->data ); + *width = image->sizeX; + *height = image->sizeY; + FreeImage(image); + return error ? GL_FALSE : GL_TRUE; } |