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

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

Posted by: admin November 30, 2017 Leave a comment


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?


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.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
   GL.LoadMatrix(ref cameraMatrix);


   // 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);



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.


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.


We faced a similar issue some time ago and the following represents our opinion only of course. One of our main concerns was that the library should be versatile, produce 3D images of very good quality, free, and not put loads of extra constraints on the installer, i.e. like with XNA where you have to have the correct files installed. This seemed like a possible source of headache. In the end we settled for DirectX and wrote the GUI in C#. All needed interaction with the 3D was done with wndproc. This provided us with both the power of DirectX and the ease of GUI development with C#. We haven’t regretted this at all.