I use D3DImage to display a sequence of frames that are displayed on the same Direct3D surface one after another. My current logic is this:
- Display last displayed frame (i.e.D3DImage.Lock () / AddDirtyRect () / Unlock ())
- Start Rendering Next Frame
- Wait until the next frame is ready, and so that it displays it
- Show last displayed frame
- ...
The problem with this approach is that when we finished calling Unlock () in D3DImage, the image was not actually copied, it should only be copied in the next WPF rendering. Therefore, perhaps we will create a new frame on the surface of Direct3D before WPF can display it. The end result is that we see the missing frames on the display.
I'm currently experimenting with using a separate Direct3D texture to render and make a copy of the “display texture” just before the display, which gives better results, but carries significant overhead. It would be preferable to just know when the D3DImage will be updated and immediately begin rendering the next frame. Is this possible, if so, how? Or do you have an idea best?
Thanks.
source share