Sign in to follow this  
KeeperMustDie

Need Help With fading

Recommended Posts

HI, I need help with fading. For example I have two quads: one quad is black(quad A) another with image(quad B). I want to know how make quad A transparent and change the level of it transpersnts. Plz help.

Share this post


Link to post
Share on other sites
enable blending for quad a, and then just change its alpha value over time. its been a while since ive used opengl blending but it think this is all you have to do


//setup the blend func to use
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


//render quadB behind quadA
quadB.draw()

//turn on blending
glEnable(GL_BLEND);
//render quadA infront of quadb
//if you're doing glcolor to set quadA you can easily change the alpha
glcolor4f(0.0f, 0.0f, 0.0f, quadA.transparancy);
quadA.draw();





just remember that when doing blending you always have to render objects from back to front, or else it wont look right.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this