Miguel P
Miguel P

Reputation: 1292

WPF With Directx 11

right now i have a wrapper written in c++/cli, which is used in c#(WPF). This wrapper is wrapping a native c++ graphics engine into c# understandable code. But this isn't the problem(Wait...). So in WPF i have a Windows Control (Yes that is possible) that i recieve the handle from (HWND). All of this is great, and the frames are rendering, the only problem is the performance. The rendering is triggered as followed:

        ...
        System.Windows.Media.CompositionTarget.Rendering += new EventHandler(Render);
    }

    private void Render(Object sender, EventArgs e)
    {
        EngineWrapper.RenderFrame();
    }

So the fps is really low, meaning that the call rate to Render() is pretty low(because my application was origionally in MFC, and the framerate was much higher!). So I'm asking you, is there any way to boost this? A new way, another thread?(Must be possible somehow...)

Edit: I create the windows control in the following way:

        System.Windows.Forms.Integration.WindowsFormsHost host =
            new System.Windows.Forms.Integration.WindowsFormsHost();

        System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel();

        host.Child = panel;

        this.RenderCamera_WorkareaGrid.Children.Add(host);

Thank You

Upvotes: 3

Views: 3183

Answers (1)

semenvx
semenvx

Reputation: 156

you need get access to surface, that rendering your scene, and send it handle to D3DImage of WPF system. look at codeplex how it was made.

Upvotes: 2

Related Questions