Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wireframe rendering in WPF

Tags:

wpf

3d

I have to write a wireframe 3D renderer in a big WPF app that does many things But WPF has no native ability to do this.

Some people use "3D Tools for WPF" by Microsoft, specifically its ScreenSpaceLines3D class. But on the web there are complaints about slow performance and various bugs with that class, and the class library doesn't seem to have been maintained since 2007!

Others have suggested the LinesVisual3D class from the Helix 3D toolkit, but apparently that's buggy, too ( http://helixtoolkit.codeplex.com/workitem/9957 )

Charles Petzold has a 3D library - does anyone know it's reasonably robust?

So do I have any good options here? For example, is there a good way to do OpenGL3D in a WPF window? Are there other good WPF libraries that can do this reliably?

Thanks in advance.

like image 200
user316117 Avatar asked Oct 07 '12 03:10

user316117


2 Answers

Check out SlimDX. XNA and Managed DirectX etc.. are deprecated or old. Possibly also check SharpDX i haven't checked it in a while. We use SlimDX for DirectX in .NET and it is good. What you are probably looking at doing is using SlimDX to render on a D3DImage for WPF interop. Another possible option is using a hosted WinForms control and using the handle of that to interop with DirectX with SlimDX which might be faster, but you lose some easier interop with WPF's rendering engine etc. If you use the D3DImage it becomes an ImageBrush that you can set as the background of anything and you do not have to worry about airspace issues etc.

Edit: oh yeah, for some reason SlimDX doesn't have their samples in the download anymore, but their source code has the samples if you download it.

like image 199
Alan Avatar answered Nov 18 '22 14:11

Alan


This page seems to have information about using OpenGL. Microsoft also mentions using Direct3d and XNA. XNA is pretty easy to use, and if you know OpenGL already, you probably won't have much problem learning Direct3d. I admit though that when I learned Direct3d, the material on it weren't as good as OpenGL material.

like image 2
Joe Plante Avatar answered Nov 18 '22 14:11

Joe Plante