What to use? Tao, SharpGL, OpenTK, DirectX P/Invoke, XNA, MDX, SlimDX, Windows API Codec Pack [closed]

Back in the day it was easy; You made your own 3D stuff, then came DirectX, then came OpenGL. For .Net developers MDX was nice. Then XNA took over for MDX, but it its not the same. XNA seems to be very game-centric with all the content pipelining and preloading of fixed models and stuff.

So where do we stand now? After a couple of days of reasearch/trial&error I feel everywhere I look I find half developed libraries, libraries with overhead, severe limitations or libraries that are overly complex.

I want to do "free-hand" 3D stuff. For instance displaying 200k dots on a screen in 3D and move them around at 30fps (Kinect depth image). I want to make 3D screensavers, audio analysis plugins, etc. All of which is not prefabs for a content pipeline, and which require high performance. And (ehm) I want to do it from .Net.

Anyone have experience with libraries that are easy/understandable and still gives some fair amount of freedom and speed?


Solution 1:

I seem to have landed on OpenTK. I think it gives more or less direct access to the OpenGL API and doesn't require loads of dependencies.

It is comparatively easy to understand. It requires few (and understandable) lines of code to get started. It doesn't hold the objects for me so I'm free to change anything for each pass, which is great because I'm mainly working with unsafe pointers to memory.

It is of course difficult to combine speed with ease of use. Speed requires talking directly to the 3D API while ease of use requres abstraction. Therefore this must be considered a lower level API than some of the others I've tried. If I wanted to do some prefab character animation then XNA would probably be a better choice, but for my use (described above) this seems very promising so far (4-5 hours of hacking).

Some sample code:

private void Render()
{
   // Every frame
   GL.MatrixMode(MatrixMode.Modelview);
   GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
   GL.LoadMatrix(ref cameraMatrix);

   GL.Begin(BeginMode.Points);

   // Here I can add lots of points. I add 200k without any big problem.
   // It seems these points could have been passed in as an array pointer too,
   //  but I'll look at that later.
   GL.Vertex3(x2, y2, z2);

   GL.End();
   glControl.SwapBuffers();
}

Solution 2:

If you liked MDX, SlimDX should be right up your alley. It's basically a replacement for MDX, but with a lot of the questionable design decisions fixed up, and a lot more functionality included. Anything you had with MDX, you will find present in SlimDX in one form or another.

Solution 3:

Alternatively there is another C# wrapper package for OpenGL: OpenGL DotNet. Works great for me! Check it out at http://www.taylaninan.com/opengl-dotnet.php .

It wraps OpenGL up to version 4.4 and supports over 550+ OpenGL Extensions. It also supports GLU, GLUT, FreeGLUT, DevIL (Developer's Image Library), ILU and ILUT for DevIL.

It a low level API for the above libraries.