PDA

View Full Version : How to build the textures?



Ehsan Kamrani
06-14-2005, 07:09 AM
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?
-Ehsan-

jide
06-14-2005, 09:26 AM
Try the Devil library at http://openil.sourceforge.net/
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 :)

Hope that helps.

Aeluned
06-14-2005, 09:29 AM
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.

Ehsan Kamrani
06-15-2005, 05:08 PM
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.
-Ehsan-