#### Archived

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

# alpha/blending question

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

## 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 on other sites
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.

1. 1
2. 2
JoeJ
20
3. 3
frob
16
4. 4
5. 5

• 10
• 10
• 11
• 13
• 9
• ### Forum Statistics

• Total Topics
632195
• Total Posts
3004717

×