Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to learn to develop 3D and 2D graphics with either OpenGL or DirectX. I chose OpenGL as it's being used in webGL and works cross-platform.

I already know .NET well, and the C# language just fits my style very well and I feel secure with it.

However, I want to develop a game that works on Windows and Linux. Is this possible to do with the combination of C#, .NET and OpenGL. I know that OpenGL will not be a problem.

share|improve this question
Both answers so far mentioned Java so I'll comment here: should you choose to use Java, you can often compile on one platform, and use the resulting JAR file on any platform (there are occasional problems, and you should always test). It does have OpenGL bindings already, JOGL and LWJGL are the two most widely used. In addition, with the use of Java applets, your game can even easily run in a browser! This is my favorite and most appealing thing about Java; RuneScape is the most popular example of a Java applet which uses OpenGL (or DirectX!) to great effect. –  Ricket Aug 14 '10 at 15:16

6 Answers 6

up vote 6 down vote accepted

I highly suggest you take a look at OpenTK. Using it with MonoDevelop has worked out great for me in the past (Though I never wrote a full on game with it). If you stick the the C# 2.0 standard, you'll have little to no problems.

share|improve this answer
C# 3.0 and .NET 3.5 seem pretty well supported on Mono these days too. –  Mike Strobel Aug 17 '10 at 17:38

In theory, yes, you should be able to develop a 3D application using C# and OpenGL on both Windows and Linux.

In practice, this is likely to be somewhat painful: you will need to restrict yourself to the subset of functionality that works for both Visual Studio and Mono, and it is likely that you won't be able to use many tools and libraries which have been targeted at only one environment.

You will need to take a very rigorous approach of converting your project files from one environment to the other, testing early and often so as to catch problems quickly, and rewriting immediately anything that proves not to be portable. This can be very frustrating at times.

In the end, ask yourself why you would want to target Linux. If learning C# and 3D development is your main goal, maybe you should concentrate on Windows instead of getting lost in the intricate details of different platforms. If your goal is to write a platform independent 3D application, many other interesting languages, such as Java or Python, might be better options in term of portability, and they are close enough to C# that you can leverage most of your experience in that domain.

share|improve this answer
You can use monodevelop on both windows and linux and therefore don't need to convert project files. You can have a monodevelop project file and a vs.net project file. Just like you can have a vs.net 2008 and a vs.net 2010 project file but pointing to same source... etc.. –  bbqchickenrobot Aug 2 '12 at 0:41

Unity3D is developed using Mono, so of course you can!

Just be careful.

Like the others said: test your code as often as possible on 'the other OS' - and by that I mean daily.

Unity is available for Windows and the Mac, but since Mac essentially is unix, I guess it's only a matter of time/effort before Unity can target Linux..

share|improve this answer
Sometimes the best of answer lies below. Practically unity will be the best, given the op specifically mentioned C# as preferable. –  cowboysaif Sep 9 at 14:09
Unity currently supports Linux unity3d.com/unity/multiplatform/desktop –  cowboysaif Sep 9 at 14:13
Unless you are worried about their company logo in the flash screen, developing and distributing is free. –  cowboysaif Sep 9 at 14:14

SDL.NET looks like the best place to start. From their site

SDL.NET is a set of object-oriented CLS-compliant .NET bindings for the SDL gaming library and provides high-level access to audio, keyboard, mouse, joystick, TrueType fonts, various image formats, sound mixing, MPEG-1 movies, 2D video framebuffer and 3D hardware via OpenGL.

and SDL is

Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."

Qt seems to be another option for a cross platform UI.

MonoXNA and looks like a nice project, but it is still in its infancy. It may be a place for you dig in and get some great low level knowledge as the libraries come together.

share|improve this answer

Yes it's doable. If you need to check for compatibility while working with Visual Studio Mono Tools can be very helpful. But they aren't free.

Also there is always Java, which is a very similar language to C#, has great OpenGL bindings, and works virtually the same on all platforms.

share|improve this answer

Two people say yes, I'd say no.
You can do it using C# and OpenGL, but not using .NET. .NET is Windows specific.
Go with Mono and the libraries they support and you should be good. .NET framework is never fully ported (it's a hairy subject) but the base libraries are, so a lot of knowledge is applicable, but to be fact specific, no, a project developed with .NET is not guaranteed to compile or run on Linux.

Okay, edited to add, yes you can, if you don't use unported features. .NET is not fully crossplatform. I took the porting requirements stricter than what the question asked for.

share|improve this answer
Sorry, but Mono is .NET and not Windows specific. From their front page: Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime. mono-project.com/Main_Page –  Larry Smithmier Aug 14 '10 at 17:54
That's great, but it's not saying it implements the full .NET framework, and if it is saying that, it is simply wrong. Check their roadmap: mono-project.com/Compatibility clearly certain features are not supported. I also advise you to check the wikipedia entry at en.wikipedia.org/wiki/.net_framework –  Kaj Aug 14 '10 at 18:39
.NET is not the same as the .NET Framework. If you will edit your answer above to match the title of the Wikipedia entry you reference, and state that the full .NET Framework is not supported except on Windows, then I will gladly agree with you because you are correct. But ".NET is Windows specific." is incorrect. –  Larry Smithmier Aug 14 '10 at 19:00
Fair enough. My post does say ".Net framework is never fully ported", but I indeed use the terms interchangeably (then again so does Mono in the line you quoted!). –  Kaj Aug 14 '10 at 19:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.