diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2000-06-27 17:54:44 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2000-06-27 17:54:44 +0000 |
commit | 92009554ce2e4c38c5abd4f09365ee8211570d4c (patch) | |
tree | d71416d6cf8cf15640966e62cba6672716e4dc5a /progs | |
parent | dbd52e50ff958d6e5c38b27f4fade701adb51834 (diff) |
added LoadRGBMipmaps2()
Diffstat (limited to 'progs')
-rw-r--r-- | progs/util/readtex.c | 15 | ||||
-rw-r--r-- | progs/util/readtex.h | 13 |
2 files changed, 24 insertions, 4 deletions
diff --git a/progs/util/readtex.c b/progs/util/readtex.c index e741ba5ae1b..d9a5dc78f5c 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; } diff --git a/progs/util/readtex.h b/progs/util/readtex.h index 2156383ec29..8e544f1fb82 100644 --- a/progs/util/readtex.h +++ b/progs/util/readtex.h @@ -7,11 +7,18 @@ #include <GL/gl.h> -extern GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ); +extern GLboolean +LoadRGBMipmaps( const char *imageFile, GLint intFormat ); -extern GLubyte *LoadRGBImage( const char *imageFile, - GLint *width, GLint *height, GLenum *format ); +extern GLboolean +LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ); + + +extern GLubyte * +LoadRGBImage( const char *imageFile, + GLint *width, GLint *height, GLenum *format ); #endif |