Posts Tagged ‘opentk’

OpenTK - C# and OpenGL made easy

Monday, September 8th, 2008

One of the major side projects we are working on requires the use of the real-time 3D graphics using OpenGL technology.  Normally this type of project would be the preserve of the C++ developer.  However C++ is renowned for its difficult and lengthy development time which was something we wished to avoid.

By using C# we hoped to be able to rapidly develop our 3D app whilst also giving us easy portability between Windows and Linux systems though the mono project.

The established major OpenGL binding for C# is the Tao Framework.  This framework has been around for a number of years and includes a number of additional bindings.  However it has several major problems;  the first of which is the design of libraries API is non-intuitive and adds lot of unnecessary typing.  The second and most important factor for me is its missing the ability to easily write text to the screen, something you think should be remarkably simple.

Of cource the arguement is that Tao is just a direct binding to the C libraries, this is where OpenTK steps in.  It provides the low level OpenGL access you need as well as higher level helper functions for faster and easier development.

So how does OpenTK compare to the Tao Framework?  Interestingly OpenTK is acctually based on the Tao Framework, so you get the same underlying code.  The biggest difference to me has been the ease of writing code.  OpenTK has much better type safety compared to Tao and the API is by far more logical.  This makes writing the code a pleasure compare to Tao.  The most useful aspect by far of OpenTk is its helper libraries, these save you from having to reinvent the wheel and include Vectors, Matrix and Quaternions as well as the all important printing text to the screen!

If you are considering working with OpenGL and C# I would highly recommend investigating OpenTK as one of your options.

Above is a little teaser from the project we are working on.  If you do a little bit of research you should be able to track it down…

No Comments »Tags: ,
Posted in Development |