C# Game Development - OpenGL VS. DirectX

Started by
11 comments, last by BinaryHead 18 years, 10 months ago
Hi, Im a C# programmer and I´ve been thinking too long about making games...time to make it a reality :-) For that matter, I´m thinking if I should use OpenGL or DirectX? I´ve found many OpenGL books (with high ratings) on Amazon, but they teach mainly in C++. I´ve found only one book on amazon that teaches C# game development, and that´s with DirectX (not that good ratings) http://www.amazon.com/exec/obidos/ASIN/0672326612/qid%3D1119272662/sr%3D11-1/ref%3Dsr%5F11%5F1/103-5280700-8876641 Would you recommend that I use the OpenGL books and simply change the c++ code to c# to run the examples?
Advertisement
If you feel comfortable with using C++ samples to learn and write your own C# code, then feel free to use OpenGL. If you'd prefer your examples be in the language you're using, then use DirectX.

Both are very good APIs, so as long as you're capable of porting the samples theres no particular reason to choose either over the other. If you want cross-platform code you'll probably want to consider OpenGL, and you should also keep in mind that DirectX has more than just DirectGraphics.

- Jason Astle-Adams


I´ve heard that pro games (Such as EVE Online) are developed using C++ and Python.

I have some C++ experience, but never did anything in Python. However Im best in C#, so that would be my nr.1 pick :-)

Im just still a little confused if I should use OpenGL or DirectX. I´ve seen more books on OpenGL so Im leaning towards OpenGL. Any reason why I shouldn´t?
If you're comfortable with choosing OpenGL then that's perfectly fine. It's a good API, theres plenty of reference material, and it's been used in a lot of projects, so it's well proven.

- Jason Astle-Adams

Quote:Original post by Kazgoroth
If you're comfortable with choosing OpenGL then that's perfectly fine. It's a good API, theres plenty of reference material, and it's been used in a lot of projects, so it's well proven.

Actually no OpenGL hasn't been used in what I would call a lot of projects when we are talking about managed code. You have to use a wrapper library such as Tao.OpenGL so the reference material is there but not exact.

With C# I would definately go with managed DirectX for a graphics API. I mean Microsoft has spent a lot of time making it a really nice API, and it fits with the C# coding style where OpenGL is more C-style.

Quote:Original post by BinaryHead
Would you recommend that I use the OpenGL books and simply change the c++ code to c# to run the examples?

You'll be doing a lot more than just changing a little C++ code to C# to run the examples, as you'll need to use a managed GL wrapper and than change all of the API calls to use the wrapper calls. I am not saying this is an impossible feat or anything, just that it isn't something you will do in 30 seconds.

Also this is the best book on developing with managed DirectX using C#.
Quote:Original post by Saruman
Actually no OpenGL hasn't been used in what I would call a lot of projects when we are talking about managed code. You have to use a wrapper library such as Tao.OpenGL so the reference material is there but not exact.


Excellent point. I completely miss it every time due to not having used managed code myself at all - must remember to take that into consideration.

- Jason Astle-Adams

I'd second the Managed DirectX suggestion. Tao is a nice wrapper but the amount of time the MS team spent optimizing managed directx is far more valuable. It also has actually examples in the SDK and has been used in complete games.
The added benefit of using managed C# and Direct3D, is that if the client has already installed DX9.0c then it already comes with the .NET managed runtimes (there's no "extra" install)..

Learn about game programming!Games Programming in C++: Start to Finish
I third the recommendation for using MDX if you're using C#. There really isn't any way to deploy a C# gaming application on anything other than Windows, so the "portability" argument for OpenGL goes out the window. Meanwhile, the support you get through OpenGL inside .NET is significantly poorer than what you get from MDX.

Don't get me wrong; I like OpenGL, and if you were developing in C or C++, I'd suggest OpenGL, but for .NET, use MDX.
enum Bool { True, False, FileNotFound };
Quote:Original post by hplus0603
I third the recommendation for using MDX if you're using C#. There really isn't any way to deploy a C# gaming application on anything other than Windows, so the "portability" argument for OpenGL goes out the window. Meanwhile, the support you get through OpenGL inside .NET is significantly poorer than what you get from MDX.

Don't get me wrong; I like OpenGL, and if you were developing in C or C++, I'd suggest OpenGL, but for .NET, use MDX.

Why do you say this? I was contemplating trying my hands at making a "write once, run everywhere" game with C#, TAO.OpenGL, and SDL.Net. Tao's website was down last time I checked, is it bound to Windows? Otherwise, couldn't someone with Mono installed run a game made with these technologies on basically any modern day machine? (This is just a topic that interests me. I would love if I could write fully portable code, including games, without really trying to.)
Turring Machines are better than C++ any day ^_~

This topic is closed to new replies.

Advertisement