Skip to main content
GameDev.net gamedev.net
🔒 Locked

TGA vs. BMP

Started by main_cpp Sep 11, 2003 at 11:30 AM 8 replies 17.8k views
Original Post
main_cpp
main_cpp
Hello! what are the differences between those two fileformats. Can TGA store transparent color? thanx
CaptainJester
CaptainJester
No targa cannot store transparency. However, it uses a different technique called Alpha channels. The level specified in the alpha channel determines whether the colour will be fully transparent or fully opaque or somewhere in between.

Bitmaps are similar, but do not support alpha channels.



First make it work,
then make it fast.

--Brian Kernighan

"The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were." - John Fitzgerald Kennedy(35th US President)
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][
Sander
Sander
TGA's can be compressed or uncompressed. BMP only comes uncompressed. BMP is 24 bits (RGB) while TGA can be 24 or 32 bits (RGB or RGBA). TGA's can't store 'regular' transparency as supported by painting programs like PaintShop (that's only for GIFs and the like) but the extra Alpha channel can be used to add transparency in 3D API's like OpenGL and DirectX.

EDIT: Damn.... beaten to it

Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]


[edited by - sander on September 11, 2003 12:54:22 PM]
CaptainJester
CaptainJester
quote:
Original post by Sander
TGA's can be compressed or uncompressed. BMP only comes uncompressed.


That is not entirely correct. While most bitmaps you find and indeed most bitmap programs don't use it, the bitmap file format specs do in fact support compression.

quote:
Original post by Sander
EDIT: Damn.... beaten to it



By 28 seconds



First make it work,
then make it fast.

--Brian Kernighan

"The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were." - John Fitzgerald Kennedy(35th US President)

[edited by - CaptainJester on September 11, 2003 1:20:38 PM]
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][
JohnBolton
JohnBolton
quote:
Original post by Sander
TGA''s can''t store ''regular'' transparency as supported by painting programs like PaintShop ... but the extra Alpha channel can be used to add transparency in 3D API''s like OpenGL and DirectX.


What is "regular transparency"? Is that where you specify a color or a palette index as transparent? The alpha channel determines how transparent or opaque each pixel is. How is that different from "regular transparency"?

BTW, TGA''s also support 8-bit, 16-bit, palettized, and greyscale, and more.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
CaptainJester
CaptainJester
quote:
Original post by JohnBolton
What is "regular transparency"? Is that where you specify a color or a palette index as transparent? The alpha channel determines how transparent or opaque each pixel is. How is that different from "regular transparency"?

BTW, TGA''s also support 8-bit, 16-bit, palettized, and greyscale, and more.


With regular transparency you choose one colour to be the transparent colour. You therefore cannot use that colour as a displayable colour. And typically regular transparency is only used with an indexed palette. With alpha channels, you can use any colour as the transparent colour, plus you can make some only partially transparent.



First make it work,
then make it fast.

--Brian Kernighan

"The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were." - John Fitzgerald Kennedy(35th US President)
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][
flangazor
flangazor
If you want textures with transparency in opengl, look up libpng.
main_cpp
main_cpp
Hello

I want to use textures with transparency in DirectX? Does anybody know how to do that, or is there any source code out there?

thanks
flangazor
flangazor
Again, you can load a png and use that as a texture. ID3DXSprite::LoadTextureFromFile(...) can load a png file, iirc.

In opengl, you will need libpng. It is very easy to use and comes with examples that you can cut and paste into your project.

Its a dandy lib and will sort out all your transparent texture needs. The file sizes are non-lossy compressed, too!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.