• Advertisement
Sign in to follow this  

Need Help With fading

This topic is 4101 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, 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
Advertisement
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
Sign in to follow this  

  • Advertisement