Jump to content
  • Advertisement
Sign in to follow this  
MattJack2000

DirectX and WPF

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

Dear all,

I am migrating a 3D application from windows forms to WPF. It's a google earth-like application, displaying charts.
To display my 3D scene I use a D3DImage. For 3D Rendering, I'm using managed DirectX 9.0.
I notice a big performance loss, and I would like to know if there are good practices about to use of D3DImage.

First try: In my main WPF control, I subscribe to CompositionTarget.Rendering, and in my OnRendering method I do this stuff :

if (_D3DImage.IsFrontBufferAvailable)
{
_D3DImage.Lock();
// DX rendering here...
_D3DImage.AddDirtyRect(new Int32Rect(0, 0, (int)_D3DImage.Width, (int)_D3DImage.Height));
_D3DImage.Unlock();
}
My business logic is subscribed to MouseMove/MouseDown/MouseUp to implement a "drag"

Result :
When my WPF main form is full screen, I miss plenty of MouseMove. As a consequence for my app, the "dragging" operation is very jerky (the camera is moved every
I have added Console.Writeline to trace when the mousemove occures, and when the DX rendering is done :

RENDER
RENDER
RENDER
... (x10)
RENDER
RENDER
RENDER
RENDER
MOUSE MOVE
MOUSE MOVE

RENDER
RENDER
...
But when my main WPF window is smaller (less than 2/3 of the screen) then this sequence becomes normal. : I get about 2 mouse move per frame, it's cool.

RENDER
MOUSE MOVE
MOUSE MOVE
RENDER
MOUSE MOVE
MOUSE MOVE

Strange isn't it? Any feeling or idea?

Well, more generally, I'm looking for somel "best practice" on "how to integrate a DX rendering in a WPF app. D3DImage looks slow, and my app is much slower in a WPF environment than previously (with Windows forms)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!