I’m developing a WPF application showing a 3D scene. While I use the Viewport3D
control to display 2D WPF controls within that scene, I use native Direct3D 11 in a transparent overlay window for complex animated 3D geometries. This works fine.
The one and only problem is, that currently there may be a significant delay because the Direct3D overlay window is not synchronized with the WPF Viewport3D
. It becomes only visible when the camera is moved around because then the Viewport3D
rendering has to be updated just like the Direct3D rendering. Ideally, the Direct3D buffer should be swapped immediately after the WPF buffer.
My question: Is there any way to execute code just after the Viewport3D presents its contents? Or at least close to that moment? Does not have to be a clean solution – I could also live with a dirty native hack …
I managed to create a method which gets called from RenderContent
of the (internal) Viewport3DVisual
class, but this is executed more often than the actual present to screen and probably not on the render thread.