• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Getting Transparency in Bitmaps!

## Recommended Posts

I have this nifty little 2d sprite engine, but I can''t seem to get transparency working at all. It uses .bmp file format, and I don''t want to use .tga for the sake of my users (that''ll use the software). So I need to keep it in the bmp range. I just need to know how to make the color black (#000000, 0,0,0, B L A C K, ) transparent. I''ve tried some stuff, but I guess I just can''t figure the right way to do it. I got one to work, but it made the rest of the image semi-transparent, which isn''t what I wanted, and I don''t want my users to have to go through the trouble of masking, so I just need the one black color transparent. Any ideas? - Twilight Terror of Syntesis

##### Share on other sites
Simple, just loop through the image, if the current R-G-B is 0-0-0, then set that bit in the alpha channel to black (transperent), other wise set it to white (solid).

I bleave Nate still has a color key demo on his site (http://nate.scuzzy.net)

Edited by - NitroGL on June 27, 2001 10:18:05 PM

##### Share on other sites
 glDisable(GL_DEPTH_BUFFER); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE);

That should do it for you, as long as the texture''s background is completely black.

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials

##### Share on other sites
Okay, that color key is fine and dandy... but I need it in a bmp, not raw. Can you please help me out? :-P

I'm using the color key idea.

- Twilight Terror of Syntesis

Edited by - Twilight Terror on June 30, 2001 12:48:43 PM

##### Share on other sites
why do so many ppl use bmp files?

http://members.xoom.com/myBollux

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978614

• 13
• 12
• 10
• 12
• 22