added LoadRGBMipmaps2()
This commit is contained in:
@@ -266,6 +266,15 @@ static void FreeImage( TK_RGBImageRec *image )
|
|||||||
* Return: GL_TRUE if success, GL_FALSE if error.
|
* Return: GL_TRUE if success, GL_FALSE if error.
|
||||||
*/
|
*/
|
||||||
GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat )
|
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;
|
GLint error;
|
||||||
GLenum format;
|
GLenum format;
|
||||||
@@ -290,14 +299,18 @@ GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat )
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = gluBuild2DMipmaps( GL_TEXTURE_2D,
|
error = gluBuild2DMipmaps( target,
|
||||||
intFormat,
|
intFormat,
|
||||||
image->sizeX, image->sizeY,
|
image->sizeX, image->sizeY,
|
||||||
format,
|
format,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
image->data );
|
image->data );
|
||||||
|
|
||||||
|
*width = image->sizeX;
|
||||||
|
*height = image->sizeY;
|
||||||
|
|
||||||
FreeImage(image);
|
FreeImage(image);
|
||||||
|
|
||||||
return error ? GL_FALSE : GL_TRUE;
|
return error ? GL_FALSE : GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,11 +7,18 @@
|
|||||||
#include <GL/gl.h>
|
#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,
|
extern GLboolean
|
||||||
GLint *width, GLint *height, GLenum *format );
|
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
|
#endif
|
||||||
|
Reference in New Issue
Block a user