Portable Texture Loading

I have been looking around for some way to load textures that don’t rely on windows, or is not set to a certain operating system. I don’t suppose anyone has a way? I don’t really care about the file type, although jpeg would be preferred.


simple TGA loader :

jpeg is quite complex so will need a cross-platform lib such as libjpeg (google for it).

I am against targa. It has some non-trivial things in it (like 1bit alpha). I raccomand using pnglib instead. PNGs have better compression than TGAs, although not as good as JPG. They are however, much easier to use and looks like there are no sort of patents around.
I’m sorry I cannot give you any link for pnglib.
PNG is lossless and supports 16bit color. I’m not sure if JPG can do this second thing.

I am all for .tga when it comes to textures.
As long as you stick with 24 or 32 BPP its extremly simple to deal with and once you put them into an compressed file container you get the same compression levels as with single .png files.

IMHO jpeg is the worst file format one can use when it comes to textures, you want to know why?


Hey, in JPEGs defense it was designed for photographs. Yelling at it for not being able to compress textures as well as it does photos is like yelling at Hummer when their car breaks down in an offroad situation, it’s just doing something it wasn’t designed to do. (ZING)

You are barking up the wrong tree.

Nobody said that Jpeg are bad in general, just that jpegs are bad for textures.