3D in managed mode (WPF, and not only)

In this week I had the chance to do a little work with WPF 3D capabilities.

I wanted to implement a user control implementing a visualizer of “something” in 2D for a Windows.Forms application. I decided to add a 3D view capability. Language used was C#.
I started with Managed DirectX. It’s crap. Simply put, there exist just two versions of MDX and they are not compatible (!). Plus the first one is very buggy (if you write a 50 lines program and find a bug in the SDK, you can claim it’s very buggy :(). The DLLs do not come with the framework. Last but not least they are abandoned, because MS decided to develop XNA.

I could go with XNA, but XNA is not, again, distributed with the framework, and is very game oriented. I didn’t want to force business users to run an XNA installer for a non-game application, specially taking into account that the 3D visualization is not a requirement, it’s an added feature of the component.

OpenGL wrappers exist, but the first one I found has been abandoned. Not the solution I wanted, but still better than MDX/XNA.

So I went to WPF. The 3D is not very complex and so WPF it’s enough.

I developed a 2D control using Windows.Forms and System.Drawing and then left the 3D part to an internal, hidden, control developed using WPF (thus my control is in the end what MS calls an hybrid control — supported scenario ;)).

So, let’s go with some considerations about WPF.

Edit :

I was forgetting a very important consideration.

WPF is fixed function, sadly. No shaders. In 2007 this is like releasing a single tasking operative system. I don’t know if I will use this Windows 3.1 of 3D in the future, on second thought.