Jump to content
  • Advertisement

Archived

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

IkeClanton

Fade in and fade out effects...

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

I''m trying to do some fade in/out effects in an OpenGL scene and I can''t come up with a good way to do it. I think that the easiest way would be to just use Ortho mode and throw a black texture mapped polygon in front of the screen, then gradually increase or decrease the blending rate, but I don''t know how. Is there a way to specify how much blending is being done on a numerical basis? Basically what I want is something like this: fadeout() { Switch to Ortho for (int i = 100; i>0; i--) { Blend( i ); Draw Polygon } } And then it would start out blending at 100% and drop down to 0 which is completely black within 100 frames. Anybody know a good way to make this work? "I''''m going to kill you. Unfortunately, I could only afford a whiffle bat so it''''s going to take a while."

Share this post


Link to post
Share on other sites
Advertisement
I dont have an answer for the blending, but could you just use ambient lighting to fade in and out?

Share this post


Link to post
Share on other sites
You don''t really have to worry about going to ortho mode; I find that simply rendering a quad as close to the near-clip as possible works.


  
float counter = 1.0f;

glColor4f(0, 0, 0, counter);
glEnable(GL_BLEND);
DrawQuad();
glDisable(GL_BLEND);
counter -= 0.1f;


should do the trick

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!