Purpose of .tga

What is the purpose of a .tga file? I had always thought it was an opengl format but…

I have this code that reads them from file to create a texture, but I don’t see an advantage over .bmp, because both store the pixels BGR instead of RGB.

tga supports Alpha channel.

http://en.wikipedia.org/wiki/TGA

Thanks. I don’t think I’ll use it to store my images. I’ll make my own format.

Having an alpha channel in the image enables you to do more cooler and advanced blending effects. You can have objects parts semi-translucent, etc.

I recommend you to try it.
Use photoshop to edit them.

Cheers,
Rod

Making your own format is cumbersome because you must convert it to something that the image editor supports. I rather doubt you want to do that. Just use tga.

True. However, why not just use .bmp rather than .tga? A 32 bit .bmp has an alpha channel.

I still don’t see the advantage of .tga.

A 32 bit .bmp did not have an alpha channel when I last checked.

The fourth channel is used as the alpha channel: BGRA

you are both right : http://en.wikipedia.org/wiki/Windows_bitmap
“A 32-bit version with integrated alpha channel has been introduced with Windows XP”
but " it has yet to gain wide support in image editing software."
btw do whatever you want with your image loader, file formats are not related to OpenGL…

And if I am not mistaken .bmps do not have the option to be compressed like .tga do…

They also have the option of RLE compression.

I didn’t know that bitmaps had a time when they didn’t support 32 bit. Although I guess that even if Windows 98 does not support 32 bit bmp’s it really doesn’t matter because any good, modern image editing software should.

Are you sure about RLE compression? I’ve never heard of it, but on the other hand, I’ve never heard about the alpha channel either :wink:

But RLE compression is a pretty bad compression for 32-bit images, it’s only good for low-color images like 8-bit paletted bitmaps.

Btw, why not use PNG? It supports 32-bit alpha channeled images, and has a very good lossless compression.

The OP wanted something easy to load, even RGB vs. BGR was giving him trouble… :slight_smile:

both tga’s + bmps are easy to read
tga’s + bmps both have RLE compression (though if u want better lossless compression, png’s are better)
while bmp’s do support alpha it was only included in a latter version of bmp (thus support mightnt be 100% with apps), tgas have had alpha from the start.

then again, forget both tga’s + bmp’s use dds’s instead.
-easy to read
-support 2d/3d/cubemaps
-dxt compression
-mipmaps
-etc

Originally posted by zed:
tga’s + bmps both have RLE compression
In case of BMP it’s only for 4 & 8bpp indexed images, and the kind of RLE it uses is not good…

Png’s sound good to me. Know any good loading code for them instead of libpng?

And what is a dd?

Originally posted by AE:
And what is a dd?
DDS - DirectDraw Surface, can store compressed and uncompressed pixel formats.

NVIDIA Texture Tools

If you’re looking for an easy to use PNG library, use DevIL (openil.sf.net). It can read not only PNG but many image formats and it integrates nicely with OpenGL (e.g. directly load into textures).

It just has some problems with thread-safety :wink: