PDA

View Full Version : Loading JPEGs



Jan
06-11-2002, 02:58 AM
Hi,
does anyone know, how to load JPEGs? Iīd like to load them as textures. I donīt need the fileformat and decompressing methods. If there is a library or something, which gives me the possibility to load it into memory i am totally happy.

Thanks.
Jan.

dabeav
06-11-2002, 03:41 AM
Go to imagelib.org and use DevIL. It used to be OpenIL, its an image loading/utility library with OpenGL sytnax. Takes ALL the work out of loading, binding, mipmapping, and deleting images. And just like OpenGL it is for Open platform use. Ill show you how easy it is to load a image into opengl/ and mipmap it with devil. These 5 lines do it ALL.

ilGenImages(1, &WeaponImage);
ilBindImage(WeaponImage);
ilLoadImage(WeaponTextureName10);
ilutGLBindMipmaps();
ilDeleteImages(1, &WeaponImage);

and your cooking with gas. Easy huh?

Jan
06-11-2002, 04:39 AM
Why did i idiot ask now, and not 2 years earlier?!

Thank you, it seems to be really great, just as OpenGL and OpenAL!

Jan.

JML
06-11-2002, 05:58 AM
Do keep in mind that compressed JPG images may not be the best texture resources. The lossy compression that JPG uses will cause imperfections on your textures that will show especially when they get enlarged (close-ups).
I suggest you use PNG images and a PNG loader library. PNG also compresses images quite nicely, but in a lossless way.

Just my .02

Jean-Marc.