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

masking ?

Started by penetrator Nov 27, 2001 at 6:14 PM 4 replies 250+ views
Original Post
penetrator
penetrator
ok, i ask again maybe i explain better what i mean ... i have a large textured quad and i want the black pixels to be trasparent (only the true black!!! 0,0,0 ) My routine works, but also the image is trasparent. The black is fully trasparent, the image a bit. How do i manage to render it so that the rest of the image is rendered correctly with full colors and only the black pixel will be transparent ? I did some test with glBlendFunc , but it didn''t work ! Thanks glHorizon_Project

www.web-discovery.net

cardinals33
cardinals33
To make a mask, you need to make two versions of your graphic. One is the normal version with a black background where there aren''t any colors. The other should be a black and white version of the image. Wherever there is black, you should fill in white. Where there is color, you should make it all black. This way your second image will only consist of the colors black (0,0,0) and white (255,255,255). Once you have your two files you can load them both as textures. When drawing the quad, first draw it with the masked black and white texture. To do this, use the function glBlendFunc(GL_DST_COLOR,GL_ZERO), then change to the masked black and white texture and then draw the quad. After this, change the blending by calling glBlendFunc(GL_ONE,GL_ONE), change the texture to the normal version of the image, and then draw the quad a second time. This way when you apply the actual image, you have changed the background by drawing the black and white version first. Once both textures are draw using the different blending methods the texture should look okay. With the background only showing up over the black parts.
ATronic
ATronic
Are you ACTUALLY doing the 2 image way? Do what I said on your other post, it''s easier and with identical results.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"

Topic Locked

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

Sign in to reply to this topic.