Loading a JPEG as texture...

Ok. I made my own .BMP loader and my own TGA loader, but I cant make a JPEG loader, I dont understand the fileformats documents I found in wotsit.org and other sites. Any of you know where can I get some code or a “good” JPEG document?

Intel has a library (Intel JPEG Library: ijl10.dll +headers+libs+…) with which you can load (and save?) JPEGs. It’s also included in the OpenGL Challenge-pack and easy to use.

[This message has been edited by Marc (edited 08-16-2000).]

But where can i find that library ???

I found it in www.intel.com, in products/search… look for the string JPEG and you will find it.

Blotchy jpegs looks evil when stretched over 3d models

Use a lossless compression instead - png for example.

Paul.

Hi
The independant jpg group provides THE lib. for loading jpg at www.ijg.org
This lib is 100% multi platform (win, unix, but dos, atari, amiga too…), very optimized and used by everybody…

To reply about lossless compression:
ok, but jpg at quality 10 has really no visible quality lost and are smaller than a png file. For 3d apps where size is critical (for example a game wich would be distributed only on the net), I think that jpg isn’t a bad choice. Moreover, a lot of free texture available on the net are in jpeg, so you will add no gain to convert them to a lossless compression format…
Finally: q3 uses jpg
In my case, I use png for texture with an alpha channel and jpg for the others…

Mandor

Thought I would add my two cents…

I have found that using jpeg just didn’t give me the quality I wanted. Maybe the images that I was using were not of a high quality… But I have done quite a bit of work with PNG and I have found it to be fast to load and the file sizes are quite small (the application I’m working on makes extensive use of very large textures 512x512 ).

There is also source code available to get you started using png for opengl textures. You can find the source at
http://www.wyatt100.freeserve.co.uk/download.htm

elroy

Ideally you’ll use a texture compression format that’s hardware accellerated by your card. That way, you can put more textures in the card at the same time, which is what really counts.