PDA

View Full Version : bmp loader for glut?



SMELCER24
04-16-2001, 07:38 AM
does anyone know if glut has a command for loading bmp files? I used to use the glaux library,(auximagerec, and auxdibimage). I was recently introduced to glut, and I was very impressed, but I couldn't find anything in the header file to deal with loading bmp files like glaux did.

Michael Steinberg
04-16-2001, 07:50 AM
Can't you still use the aux functions?

Anyway... There are tons of functions to accomplish that on the web, but I only know about the one that I posted on the beginner forum recently. If you want you can search for bmp there.

SMELCER24
04-16-2001, 08:14 AM
I can still use the glaux lib.,but everytime I link my project using glut and glaux together I get a link error unresolved externals with the auxDIBImageload. I thought maybe glut had a command to replace this glaux command. thanks

davepermen
04-16-2001, 08:19 AM
how bout www.openil.org? (http://www.openil.org?) the open image lib is great for creating textures:


GLuint LoadTexture( char* filename )
{
/*to make sure all pics are oriented the same way*/
ilOriginFunc( IL_ORIGIN_UPPER_LEFT );
ilEnable( IL_ORIGIN_SET );

ILuint image = 0;
ilGenImages( 1, &image );
ilBindImage( image );
if( !ilLoad( IL_TYPE_UNKNOWN, filename ) )
{
ilDeleteImages( 1, &image );
return NULL;
}

GLuint texture = ilutGLBindTexImage( );
ilDeleteImages( 1, &image );

return texture;
}

and you can directly glBindTexture( GL_TEXTURE_2D, LoadTexture( "mypic.bmp" ) );

and like that, all those file formats:

// Image types
#define IL_TYPE_UNKNOWN 0x0000
#define IL_BMP 0x0420
#define IL_CUT 0x0421
#define IL_DOOM 0x0422
#define IL_DOOM_FLAT 0x0423
#define IL_ICO 0x0424
#define IL_JPG 0x0425
#define IL_LBM 0x0426
#define IL_PCD 0x0427
#define IL_PCX 0x0428
#define IL_PIC 0x0429
#define IL_PNG 0x042A
#define IL_PNM 0x042B
#define IL_SGI 0x042C
#define IL_TGA 0x042D
#define IL_TIF 0x042E
#define IL_CHEAD 0x042F
#define IL_RAW 0x0430
#define IL_MDL 0x0431
#define IL_WAL 0x0432
#define IL_OIL 0x0433
#define IL_LIF 0x0434

#define IL_JASC_PAL 0x0475


great, not?

[This message has been edited by davepermen (edited 04-16-2001).]

Michael Steinberg
04-16-2001, 08:29 AM
davepermen............ THANX!!!!!!
currently downloading... http://www.opengl.org/discussion_boards/ubb/smile.gif

There's just one thing... can one redirect the reading calls from the standard libraries to my own? I'm currently working on compressed packages and it would be impossible to put the images into them. Yes I could convert all images to jpg...

SMELCER24
04-16-2001, 01:25 PM
That openIL Library is awsome.
It fixed all of my problems thanx.