Skip to main content
gamedev.net
🔒 Locked

alpha/blending question

Started by logout 0 replies 450+ views
Original Post
logout
logout
*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 !
soconne
soconne
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.
Author Freeworld3Dhttp://www.freeworld3d.org

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.