• Advertisement

Archived

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

Clear image instead of clear color?

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

Is there a way that I can use the previous frame as the background instead of a color? I want to start with the previous frame and treat it as the background, so anywhere that I do not draw would show the previous frame. Is this even possible without editing a texture every frame?

Share this post


Link to post
Share on other sites
Advertisement
Yeah, just clear the depth buffer and render the picture at the far clip of an orthogonal projection, then switch to perspective and continue as normal.

Share this post


Link to post
Share on other sites
quote:
Original post by benjamin bunny
If you want the previous frame as a background, just don''t clear the colour buffer.

That is not a good solution when using double buffered rendering, as the content of the back buffer after a buffer swap is undefined.

Share this post


Link to post
Share on other sites
quote:
Original post by Brother Bob
quote:
Original post by benjamin bunny
If you want the previous frame as a background, just don''t clear the colour buffer.

That is not a good solution when using double buffered rendering, as the content of the back buffer after a buffer swap is undefined.


In Direct3D, you can force the backbuffer to stay.

Given that this is OpenGL, though, that''s not quite possible. Best option might actually be to render to texture, draw a single textured quad on screen as your scene each frame, and basically do that the whole time.

Share this post


Link to post
Share on other sites
quote:
Original post by Brother Bob
quote:
Original post by benjamin bunny
If you want the previous frame as a background, just don't clear the colour buffer.

That is not a good solution when using double buffered rendering, as the content of the back buffer after a buffer swap is undefined.


True. I guess the alternatives are to use glCopyTexImage2D and copy the screenbuffer to a texture, or render it to a texture directly (with a pbuffer) like promit said. I suppose you could also use the accumulation buffer if there's hw support.

[edited by - benjamin bunny on February 5, 2004 9:49:47 PM]

Share this post


Link to post
Share on other sites
Oh, one thing I forgot to mention; my suggestion of rendering to texture is going to eat twice as much fill as a normal render. Just keep that in mind.

Share this post


Link to post
Share on other sites

  • Advertisement