Jump to content
  • Advertisement

Archived

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

logout

alpha/blending question

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

*im trying to simulate color keying so thats why i ask there questions* I got a array ( or a pointer ) with the BGR data. I need to transform this into RGBA. lets say i got these varibles: uchar red; uchar green; uchar blue; uchar alpha; now i want to do

//.. thise varibles gets filled *exept the alpha value witch //dosent get filled ( so its garbage )*
FillVariables();
if(red == char(''255'') && green == char(''0'') blue == char(''255'') )
{
     alpha = 100_PERSENT_TRANSP;
}
else
{
     alpha = 0_PERSENT_TRANSP;
}
 
What states glFunc() and so on do i need to set in order to get this to work. And What do i need to set the alpha value to : 1. if i want it transp 2. if i want it solid Hope i explained myself good enoght, if you got any questions plz post em !

Share this post


Link to post
Share on other sites
Advertisement
You just need to call

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);

This will reject all incoming alpha values of 0 and accept any other ones.

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!