Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Reusing BackBuffer Contents in Direct3D Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Venki

March 19, 2005, 05:05 AM

Hi,

When we render any objects using Direct3D we do the following steps during onpaint.

1. Clear the device contents using device.Clear();
2. device.BeginScene();
3. Render the objects using a mesh or using the DrawPrimitives call.
4. device.EndScene();
5. device.Present();

When we call device.Present the contents of the backbuffer are rendered to the window.

If I am quite sure that the contents of my scene has not changed, then I tried the following.

if (scene contents has not changed)
{
device.Present(); Just present the previous back buffer contents.
}
else
{
Do the normal steps of clear, beginscene, render, endscene, present.
}

However when I just do Present to render the previous backbuffer contents I get lots of flicker and background gets painted with some strange colors and then the object is rendered.

I am trying to make my painting in Direct3D more optimized. When the backbuffer has not changed why render everything again.

Can someone comment on this ? Thanks.


 
Axel

March 19, 2005, 05:15 AM

Just do no Present if nothing has changed.

 
juhnu

March 19, 2005, 05:52 AM

It all depends on how you create your device. it is possible to force driver to use the copy swap effect, which quarantees the backbuffer will stay intact. You can set the approriate flag D3DSWAPEFFECT_COPY for the D3DPRESENT_PARAMETERS when creating the device if you really want this behaviour.

However using this flag instead of the D3DSWAPEFFECT_DISCARD is not recommend as it's likely to cause extra overhead and rejects the display driver to select the most approriate and the fastest way to show contents on the screen. You can't use multisampling either and are restricted to have only a one back buffer in your swap chain if you force the copy swap effect.

the red/greenish flickering is due to the debug runtime filling the contents of the buffer when using the discard swap effect in order to alert developers they're doing something wrong.


juhani

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.