PDA

View Full Version : Purpose of .tga



AE
04-11-2006, 06:04 AM
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.

ZbuffeR
04-11-2006, 07:09 AM
tga supports Alpha channel.

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

AE
04-11-2006, 08:02 AM
Thanks. I don't think I'll use it to store my images. I'll make my own format.

Rodrix
04-11-2006, 01:41 PM
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

Joe the Programmer
04-11-2006, 04:49 PM
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.

AE
04-12-2006, 05:17 PM
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.

Joe the Programmer
04-12-2006, 06:09 PM
A 32 bit .bmp did not have an alpha channel when I last checked.

AE
04-12-2006, 06:28 PM
The fourth channel is used as the alpha channel: BGRA

ZbuffeR
04-13-2006, 05:14 AM
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...

Mars_999
04-13-2006, 12:13 PM
And if I am not mistaken .bmps do not have the option to be compressed like .tga do...

AE
04-13-2006, 03:50 PM
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.

Overmind
04-15-2006, 02:17 AM
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 ;)

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.

ZbuffeR
04-15-2006, 09:20 AM
The OP wanted something easy to load, even RGB vs. BGR was giving him trouble... :)

zed
04-15-2006, 02:50 PM
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

Serge K
04-15-2006, 04:25 PM
Originally posted by zed:
tga's + bmps both have RLE compressionIn case of BMP it's only for 4 & 8bpp indexed images, and the kind of RLE it uses is not good...

AE
04-15-2006, 05:15 PM
Png's sound good to me. Know any good loading code for them instead of libpng?

And what is a dd?

Serge K
04-15-2006, 07:46 PM
Originally posted by AE:
And what is a dd? DDS - DirectDraw Surface, can store compressed and uncompressed pixel formats.

NVIDIA Texture Tools (http://developer.nvidia.com/object/nv_texture_tools.html)

Overmind
04-16-2006, 04:00 AM
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 ;)