Jump to content
  • Advertisement
Sign in to follow this  
ekrax

OpenGL masking

This topic is 5194 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok i have a simple question but can't quite figure it out how to do it with opengl and glBlendFunc ... is there anyway i can just enable glBlend and whatever textures are withen glBlend being enabled and glBlend being disbale a certain color is always masked out so nothing is drawn there and i can see the background? so is there an easy way to say mask out glColor3f (1.0f, 0.0f, 1.0f) ? thanks for any help in advance

Share this post


Link to post
Share on other sites
Advertisement
You can't mask out a certain colour directly (well, unless you want to use a moderately complex colour keying fragment shader), especially not with glBlend. But you can mask out parts by using the alpha channel. After loading your textures, simply loop over all texels with the CPU, check if the texel colour equals your transparent key colour, and set the alpha component of the texture accordingly. Then you can make these parts transparent using standard alpha blending.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!