Skip to main content
gamedev.net
🔒 Locked

Color transparency?

Started by nife May 1, 2004 at 8:43 AM 3 replies 750+ views
Original Post
nife
nife
I have read about it in the RedBook, but I don''t fully understand it yet. How do you make a bitmap (or polygon)transparent (disappear totally I mean), if you for example has chosen the color purple (255, 0, 255) to be transparent. I know that you have to use use glEnable(GL_BLEND) and glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA_MINUS_ALPHA) to optain the transparency, but how to make a certain color transparent?
Killers don't end up in jailThey end up on a high-score!
snyp
snyp
Why would you want to draw this bitmap if it will be totally transparent? DONT DRAW IT AT ALL
Actual Linux penguins were harmed in the making of this message.
benjamin bunny
benjamin bunny
The alpha channel determines the opacity in the blend mode you just mentioned. e.g., if you want a half-transparent red poly, then you might use glColor4f(1,0,0,0.5). If you want to set certain colours in a 3-channel texture to transparent then you need to set the alpha values appropriately when you load your texture.
nife
nife
Snyp --> Sorry didn't ment the entire bitmap, just ment that pixels with the color purple wouldn't be drawed.

Benjamin Bunny --> Know what you're saying, but don't really know how to do it. Currently I'm fetching all the pixels in the bitmap and then use the standard glGlenTextures and glTexImage2D to build the picture. I won't post source code you can edit, since most people in here programs in C++ and I program in Object Pascal, so many wouldn't understand. But I can write and read C++ so just post the code in C++. BTW if there's any Object Pascal programmer who wants to help, just ask, then I'll post the source code of course.

[edited by - nife on May 1, 2004 10:59:26 AM]
Killers don't end up in jailThey end up on a high-score!
nife
nife
Just forget it...discovered it myself...just added an alpha-channel to my array and changed GL_RGB to GL_RGBA in glTextImage2D. Further more I added Blending before drawing the polygon, and now it works fine. But thanks for your replys.

[edited by - nife on May 1, 2004 4:57:28 PM]
Killers don't end up in jailThey end up on a high-score!

Topic Locked

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

Sign in to reply to this topic.