Jump to content
  • Advertisement
Sign in to follow this  
MatrixCubed

Using a texture's alpha channel to produce solid colors

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

Hi all, I'm trying to do something which is seemingly simple, but I can't figure out how to accomplish it. I want to be able to render objects in my game with solid color values (rather than textured) but I want to color-key the objects with the alpha-channel of a texture. Is there a simple method of doing this? I have been unsuccessful in finding a solution (either here, or on the web). Any help is appreciated!

Share this post


Link to post
Share on other sites
Advertisement

Right... I have the following states set up to accomplish the effect described in my original post:

glAlphaFunc(GL_NOTEQUAL, 0.0f);
glEnable(GL_ALPHA_TEST);
glEn/Disable(GL_TEXTURE_2D);
glColor4ub(r, g, b, a);
glEnable(GL_BLEND);
glBlendFunc(GL_NOT_SURE, GL_NOT_SURE);

The above bolded is what I'm unsure about...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!