I would like to render two scenes in OpenGL, and then do a visual crossfade from one scene to the second. Can anyone suggest a starting point for learning how to do this?
Cheers
I would like to render two scenes in OpenGL, and then do a visual crossfade from one scene to the second. Can anyone suggest a starting point for learning how to do this?
Cheers
The most pmajor thing you need to learn is how to do render-to-texture.
When you have both scenes in 2 textures it really is simple to crossfade between them. In fact its pretty simple to do all manor of interesting fade effects :)
Here's sample code of a cross fade. This seems a little different than what Goz has since the two scenes are dynamic. The example uses the stencil buffer for the cross fade.
I could think of another way to crossfade scenes, but it depends on how complex your scene renderer is. If it is simple, you could start a shader program before rendering the second scene that does the desired blending effect. I would try glBlend (GL_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and manipulate the fragments' alpha values in the shader.
FBOs are btw. available for years already - extension or not. If your renderer is complex and uses shader programs, you could just as well render both scenes to FBOs and blend these. Using FBOs is a very common technique for allowing to easily apply all kinds of effect rendering.