Jump to content
  • Advertisement


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


Color Key - Possible in Opengl?

This topic is 5487 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

Is it possible to create a texture where a certain color value will be drawn transparent and the rest will be visible?

Share this post

Link to post
Share on other sites
You could generate an alpha channel for your texture. Scan through the texture at load-time. Set the alpha channel to 0 when the transparent colour is found and non-zero for the others. When rendering, enable alpha testing (glEnable(GL_ALPHA_TEST) IIRC) with an appropriate glAlphaFunc value (I forget the exact constant, but it should be pretty obvious -- maybe something like glAlphaFunc(GL_GREATER, 0.0)).

EDIT: Or you could use alpha blending instead, probably, if you didn't want to add extra info. However, I suspect that may not be as fast...

[edited by - Alimonster on November 13, 2003 5:17:22 AM]

Share this post

Link to post
Share on other sites

  • 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!