WPF and DirectX 11 via D3DImage

前端 未结 3 1836
忘了有多久
忘了有多久 2020-12-30 15:16

I want to use DirectX 11 from unmanaged C++ code and use WFP for the GUI. SlimDX is not suitable for me. I have found the solution to make working WPF with DirectX 10:

3条回答
  •  粉色の甜心
    2020-12-30 15:49

    I can't comment on how to make DirectX11 work with that example, but the 5% CPU you are witnessing is probably the render loop in DirectX spinning but with no work to do.

    A render loop is commonly used in games to render "as fast as you can" while updating the scene/physics/AI on a different thread. In desktop visualization applications this is not usually necessary.

    For scientific visualization applications where updates to the GUI only occur when the user interacts (e.g. drags an item, pans the viewport) I've redesigned the render loop to only render when there is an update. ie: after your work to pan the viewport within mousemove, you force DirectX to re-draw by setting a flag or similar. This way "drawing when you need it" will reduce your CPU to near zero while the application is idling and is more suitable for desktop applications.

提交回复
热议问题