How to build the textures?

I want to use from the TGA and BMP textures in OpenGL. The codes that load these images are well defined, but i can’t load the pictures saved with photoshop. I can load the Bitmap files created with paint and i have found some targa files and i can load them. but when i create a new picture with photoshop and save it as tga or bmp file, i can’t load it. Which software do you use to make the uncompressed targa and bitmap files? In photoshop, when we want to create a new picture, we should adjust its resolution, its type, etc. which resolution should i use for my pictures?

Try the Devil library at
Their code might know all the inside-outs and top-downs of each format.

What I could say is that bmp format is special. I’ve never used such images thought. TGA are not really complicated but if you want some compression or so, most of codes we can find on internet don’t support that (or maybe it is the origin).

Another thing I’d like to say is that supporting thousands of formats isn’t a goal on its own, it’s a bottleneck, really. Theoretically, supporting a single format would be best, so that you don’t spend too much time in those minor objectives. I personnally prefer the RGB format. It supports traditionnal RGB but also RGBA values. It can also be compressed. And use a good image format translator just as Gimp, that’s free.

PS: I can provide you some code in order to load rgb images, however I’m not sure if my code support the alpha channel (never tested it :slight_smile:

Hope that helps.

If you’re not using texture rectangles (which I’m assuming you’re not) your texture must have dimensions MxN where M and N are both powers of two.

Also, you might have to save the image as 32-bit, I can’t remember if that’s a requirement though.

Hi Jide
I downloaded the DevIL SDK and taked a quick look at its specification. It is reallt greate!I’ll use from that API as soon. Also i my problem with photoshop solved. I should create a mask with photoshop to add an alpha channel to the targa file.