PDA

View Full Version : TGA vs BMP



Harmony
09-23-2001, 08:51 PM
What are the advantages of TGA over bitmap.

I currently doing some nehe tutes that use TGA textures instead of BMP textures. The load texture function is infinately more complex than for BMPS.

My question is why would I want to use tga over bmp.

thanks.
Ryan

Harmony
09-23-2001, 09:10 PM
alpha channel?

http://www.opengl.org/discussion_boards/ubb/smile.gif

marcus256
09-23-2001, 09:47 PM
Portability?

Try writing a BMP loader on your own, without using any Windows functions, and you will find that loading a TGA image is much simpler than loading a BMP image.


[This message has been edited by marcus256 (edited 09-23-2001).]

Korval
09-23-2001, 10:15 PM
I'd have to agree that BMPs have fewer arguments/flags in their headers, thus making them easier to load than TGAs. However, TGAs do have alpha channel support, so that counts for something.

In any event, the formats are not radically different. Writing a loader for one or the other isn't that difficult.

stefan
09-24-2001, 12:04 AM
Have you considered using PNG? You can use alpha as well and have a nice compressed format without loss of quality. There's libpng and a lot of helper librarys to make loading png painless.

tinman
09-24-2001, 02:32 AM
...you can compress TGAs too...

Michael Steinberg
09-24-2001, 05:50 AM
PNG decompression is superior to TGA's.
Bitmap compression is crap.
But I have to disagree in some point. I actually find bmp to be read more easily since it doesn't have so many informations to be parsed.
On the other hand TGA supports alpha. Best format remains PNG but it's hard to code a reader for that. But there's a libpng (or was it another name?) that handles this for you.

Michael Steinberg
09-24-2001, 05:51 AM
Note that the MSDN bitmap documentation is crap. If you need support with this call me.

ppinter1
09-24-2001, 07:08 AM
For loading BMP, TGA (including compressed) and 3DS meshes from 3D Studio MAX, check out Mesh3DS; a Visual C++/MFC class that should simplify your work.

The routines LoadBMPfile and LoadTGAfile particularly.

http://p-squared.com/SpaceTime.asp#Mesh3DS

If you don't use MFC, the texture loading routines should still be useful.

/p2

Michael Steinberg
09-24-2001, 08:59 AM
TGA basically uses the same compression method as bitmaps do, run-length encoding. Supporting that is just a waste of time unless you have textures that could benefit of it. They are quite rare, especially photographies or any other type of wall textures are not really good for run length encoding...

DFrey
09-24-2001, 09:17 AM
TGA's are very suitable for fonts.

Michael Steinberg
09-24-2001, 11:22 AM
Yes! One of the cases where RLE is effective (did you mean compression at all DFrey?)! Anyways, I'm using TGA most of the times too, I don't compress them but could read compressed ones. I don't see any sense in compressed textures BTW, since you have to decompress them upon loading... http://www.opengl.org/discussion_boards/ubb/smile.gif It's just that PNG compression is best of the one you've been talking about, and it is lossless, in spite of jpg for example!

DFrey
09-24-2001, 02:46 PM
Yep, that's what I meant. Fonts typically compress extremely well with RLE. One reason to use compressed textures is that it is often faster to load and decompress a texture than it is to load the equivalent uncompressed texture. (Of course I am not talking about memory resident compressed textures, e.g. DXTn.


[This message has been edited by DFrey (edited 09-24-2001).]

MrShoe
09-24-2001, 04:22 PM
Ahhh, someone said that it is impossible to write a BMP loader without using windows functions... errr, no it isnt... its actually quite easy, around 1 page of C code...

Michael Steinberg
09-25-2001, 02:20 AM
MrShoe: I burn to see your reader that only takes a page with all possible formats. But you are right, you don't need any windows functions for that. BUT you need to copy the structure definitions to the header file of course.

DFrey! Gonna benchmark the decompression and an uncompressed pic!