Using cairo, OpenGL, and C#
April 26, 2007
I’m just starting to play with combining a vector-graphics library with OpenGL. I also wanted to take advantage of all the great features of C# and .NET, as well as using a solution that would port easily between Mac OS X, Windows, and Linux. In the end, I decided that using cairo for vector graphics and the Tao Framework for OpenGL was the way to go.
The Mono Project has C# bindings for cairo, but unfortunately the latest version still didn’t support everything I needed. I was fortunate, however, to come across cleaned-up cairo-sharp library at NDesk. I took the latest snapshot, and because I don’t have make installed on my computer, I simply created a Microsoft Visual C# Express class library project, put all the files inside of it, and built the Mono.Cairo.dll assembly.
There were several links that were especially pertinent to what I was trying to do. Cairo has a guide to using cairo and OpenGL, and the Mono Project had some information about using the Mono.Cairo bindings. Unfortunately, their links to more samples did not seem to work.
In the end, I was able to get a very simple example working. The steps are after the jump: