View Full Version : TGA vs BMP
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.
09-23-2001, 09:10 PM
09-23-2001, 09:47 PM
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).]
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.
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.
09-24-2001, 02:32 AM
...you can compress TGAs too...
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.
09-24-2001, 05:51 AM
Note that the MSDN bitmap documentation is crap. If you need support with this call me.
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.
If you don't use MFC, the texture loading routines should still be useful.
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...
09-24-2001, 09:17 AM
TGA's are very suitable for fonts.
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!
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).]
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...
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!
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.