I am trying to evaluate helixtoolkit for use in an existing WPF application. I cloned the repo and compiled everything, but when I try to execute any of the WPF.SharpDX examples I get an error message in the application:
System.InvalidOperationException: Cannot call this method without a back buffer. at System.Windows.Interop.D3DImage.AddDirtyRect(Int32Rect dirtyRect) at HelixToolkit.Wpf.SharpDX.DPFCanvas.UpdateAndRender() in C:\helix-toolkit\Source\HelixToolkit.Wpf.SharpDX\Controls\DPFCanvas.cs:line 753
However, I think this is a bit misleading. When I look at the code, it is failing on line 102 of DX11ImageSource:
this.renderTarget = new Texture(DX11ImageSource.device, target.Description.Width, target.Description.Height, 1, Usage.RenderTarget, format, Pool.Default, ref handle);
With the following exception thrown:
'SharpDX.SharpDXException' in SharpDX.dll HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
I even tried making my own possibly simpler project and using NuGet to import the helixtoolkit libraries and I get the same error. At home I can execute everything on my personal computer so it appears to be some (mis)configuration on my work laptop. Both machines are Windows 10, using VS2017 with AFAIK updated drivers. I'm not sure where to go from here to diagnose the error.
I have also tried Microsoft's WPF DirectX Extensions (https://github.com/Microsoft/WPFDXInterop) and it works properly. Finally, I tried compiling SharpDX but it doesn't include any sample code for me to run. If anyone has any suggestions, I'd love to hear them.
Customer support service by UserEcho