Idea for scene transitions
Hi,
i''m going to implement in a space strategic game some special effect when the rendering change from a scene to another one. when the player click on a View button in a window, for example view a planet, the screen fades to the planet rendering.
my idea is to take a copy of the screen in the instant when there''s the click and after that i loop a subroutine where i only for example fade to black this screenshot and when finished go out the loop and move to the new scene.
There''s a way to make this fast? i''ve read of the functions glReadPixels and glDrawPixels but reading around i''ve understood that they are slow routines. another way is for example converting the "screenshot" in a texture and after that make it screen size and apply all things i want to do?
some of you have never coded something similar? I hope to receive some tips, to understand better the common way.
Thanks
if you have the particular extentions, you can render the image into a texture. else you will have to use glReadPixels / glDrawPixels or - in case you have a little "screen" you display your stuff on - you could use software rendering/rasterizing and afterwards use glDrawPixels or upload it as texture...
With the glCopyTexImage2D() and glCopyTexSubImage2D() functions you can copy a portion of the framebuffer to a texture. Since it''s a VRAM to VRAM operation it''s pretty fast. NeHe''s tutorial 36 uses these functions to achieve a radial blur. Check it if you need some help to understand their usage.
Thought the glCopyTexImage2D()/glCopyTexSubImage2D() are implemented on all hardware (at least all I''ve had to deal with), you can use the WGL_render_texture extension to speed up the operation. Since you render directly to the texture, you don''t have to copy it, hence the speed improvement.
However, if you don''t need to make a copy each frame, glCopyTexImage2D() could be fast enough.
Thought the glCopyTexImage2D()/glCopyTexSubImage2D() are implemented on all hardware (at least all I''ve had to deal with), you can use the WGL_render_texture extension to speed up the operation. Since you render directly to the texture, you don''t have to copy it, hence the speed improvement.
However, if you don''t need to make a copy each frame, glCopyTexImage2D() could be fast enough.
I have a better idea for you.
Check out the glow tutorial at Nehe.
Its exactly what did Halo for scene transition.
Its a beautiful effect.
Check out the glow tutorial at Nehe.
Its exactly what did Halo for scene transition.
Its a beautiful effect.
quote:Original post by Daivuk
I have a better idea for you.
Check out the glow tutorial at Nehe.
Its exactly what did Halo for scene transition.
Its a beautiful effect.
there is no glow-tutorial at nehe''s site. the only "glow" one is at frustum''s, but i think that one doesn''t render anything into textures...
i''ve been thinking... why don''t you render your scene like you would do at stencil reflections... just without __reflecting__ it?
i''ve used glCopyTexImage2D for copying the screen on a texture (with a dimension power of 2 and >= of the sized of the screen). after that i render a quad in ortho mode with the texture on it, giving tex cordinates of SCREEN_WIDTH/TEXTURE_WIDTH and SCREEN_HEIGHT/TEXTURE_HEIGHT.
With this mode i could render the scene in the texture very fast (there''s no lag when it creates the copy). Before i''ve used glReadPixels to make the texture but it was terrible slow (1-2-3 seconds of "pause" before render the image)
now i could fade easily the image with a change of glColor from white to black applied to the scene. now i''m looking for some nice effects
With this mode i could render the scene in the texture very fast (there''s no lag when it creates the copy). Before i''ve used glReadPixels to make the texture but it was terrible slow (1-2-3 seconds of "pause" before render the image)
now i could fade easily the image with a change of glColor from white to black applied to the scene. now i''m looking for some nice effects
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement