Why TGA not BMP?

Why most people use TGA for textures not BMP.

Not sure, but maybe because TGA’s are slightly easier to load.

Because TGA’s can have a 4th colour channel (called an alpha channel) used for variable transparency with a single pass

Here look at
http://cyberintel.multimania.com/1content/index.html

and go to gllesson4 they are loading and explain why they loading tga files

BMP format has much not important varialbles
in the header.Also hasn’t alpha channel.
It is very bad format.That is my opinion.

The alpha channel? Is it useful

Alpha channels are used primarily for blending (transparant) polygons … check out nehe.gamedev.net for some good tutorials

[This message has been edited by Shag (edited 11-08-2001).]

BMP’s are a microsoft format. Not every graphics program on every OS support them, so the targa (TGA) format which is generally universal is used instead. This makes cross-platform-ing easier. A really nice file format is PNG. It contains alpha channels and compression. The spec is also pretty open, and you can download some of the design docs.

>>BMP’s are a microsoft format

If I remember correct, BMP’s originally came from IBM, so they are not “some Microsoft stuff”.

>>Not every graphics program on every OS support them

… nor does every graphics program on every OS support TGA or PNG. No format is supported by every program on every OS.

>>This makes cross-platform-ing easier

Generally you develop on a “main platform”. If this is Windows, you create you images on this Windows machine. If you also support another OS, you use the same files, cause nothing stops you from loading your BMP’s under Linux, MacOS(X), Solaris, and so on. So BMP’s are as “cross-platform” as any other file format.

An by the way, even though BMP’s does not directly support an alpha channel, it has support for 32-bit BGRA images, where the alpha channel is ignored ( = waste of space). This “waste-of-space alpha channel” can be used, by the user, to store an alpha channel, and still being able to view the image in most/all programs (that supports BMP’s of course).

ok, first, you are confusing bitmaps and *.bmp files. a “bitmap” is a file that has an uncompressed map of all the bits in an image, but it is not a specific file format (more like a type of file format). a file that ends in *.bmp IS a microsoft proprietary format. maybe they didnt create it, but they have changed it many times.

unfortunately, microsoft isnt very good about documenting their formats, and if you want to be able to load it cross-platform, you have to write your own functions to load it (instead of the microsoft ones, which only work with windows). this would be fine, except it isnt well documented, there are several versions, and there doesnt seem to be anything in the header that tells you WHICH version of the file format the image is using. in the end its a pain to use.

as for a “waste of space alpha channel” if no programs use it, it is a waste of space, unless this person wants to write their own image editing software that lets you use the alpha channel.

for the lazy programmer, i would suggest using one of the image file libraries (libpng, libjpeg, etc). i, personally, like png, but thats just a personal preference. there does happen to be a library that will load a png directly into an openGL texture. you can find it here:
http://www.wyatt100.freeserve.co.uk/download.htm

im sure others exist for other file formats, but i happen to know about this one…

I think that most people use neither TGA nor BMP. Most people use some compressed format, unless they are careless (like NVIDIA with their demos) about wasting your bandwidth and disk space.

No, 3D Studio Max, OpenGL demos, 3D games all use TGA as texture images.

Both TGA and BMP can be compressed…

>>No, 3D Studio Max, OpenGL demos, 3D games all use TGA as texture images.

Please explain what you mean by that. 3D Studio MAX can use more than just TGA’s as textures. 3D games/demos can use any image format they like, whether they use OpenGL or not makes no difference.

Originally posted by mikael_aronsson:
Both TGA and BMP can be compressed…

But not nearly as efficiently as using JPEG or something like that. Sorry, it just bugs me because some 50MB demos could be under 10MB with minimal image quality loss.

JPEG compression is ****!

why do ppl think that certain compression routines are better or worse than others? And as for stating that a demo could be reduced from 50 to 10 megs …! erm excuse me while i laugh …

>>>JPEG compression is ****!<<<<

Im guessing you think that jpeg has a bad compression?

For 24 bpp or 32 bpp, it’s quite good, maybe the best. You lose some quality however.

Bottom line, use what you want. TGA have nothing magical about them.

V-man

Everyone relax take a deep breath. When I last tried it was quite tricky to parse a BMP, I’ve writted a bmp loader, but made certain assumptions about the format being 24 bit, that made it easy, but BMPs are complex because they have gone through several revisions, so to support loading BMPs you need to support a slew of pixel depths and header stuff. On top of this I was on Windows and it was impossible even with MSDN to find any documentation on it.

Developers like something simple and quick to support, documented and hopefully with some code they can ‘borrow’, TGA probably fits that bill.

Compression is not always lossy, you can run length encode, or use something like LZ library, it’s not that hard, the trouble is it makes reading the file more tricky and for some developers that’s a negative. With compression it’s essential to have a library to load the format unless it’s REALLY simple like RLE, otherwise few people will bother. JPEG and PNG have source code available. JPEG can be very bad if you request high compression ratios but it’s the creator’s choice, you can get acceptable results by increasing the file size. Let’s not have a jihad over compression algorithms.

[This message has been edited by dorbie (edited 11-11-2001).]

I didn’t have problems with BMP. When you control the generation of BMP files, you don’t get into problems with colour depths and such.

Regarding reducing demos from 50MB to 10MB, I’m being charitable here. Download a NVIDIA technology demo, compress the sound from WAV to MP3 and the textures from TGA to JPEG and you’ll get something that’s about 10th the size and should be hard to distinguish from the full size demo.

We’re agreeing on the BMP issues. The reason I could assume that I had a 24 bit image was that I had control of it’s creation.