Archived

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

Color Key - Possible in Opengl?

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

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