Getting Transparency in Bitmaps!

Started by
3 comments, last by Twilight Terror 22 years, 9 months ago
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
- Twilight Terror of Syntesis
Advertisement
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
Celeron ][ 566 @ 850256MB PC-100 CAS2 RAMDFI PA-61 Mainboard (250MB memory bandwidth sucks, it should be 500MB)ATI Radeon 32MB DDR LEWindows 98SE
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
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
- Twilight Terror of Syntesis
why do so many ppl use bmp files?

http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement