Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What advantages exist in C++ over C# when working with OpenGL [closed]

Tags:

c++

c#

opengl

I am starting to get interested learning in OpenGL and I am trying to figure out what the best direction to go as far as which language to use in the learning process. I am already very familiar with C# and from what I have read, I can utilize the Tao API to interface with OpenGL from C# code. However, it also seems to me from what I'm reading that those who are really professional OpenGL developers are C++ programmers.

I'm curious what advantages C++ might have over C# when working with 3D graphics in OpenGL. Any input would be great as I'm a complete newby at all this.

like image 506
jdavis Avatar asked Nov 22 '11 04:11

jdavis


1 Answers

Using OpenGL via C# has some difficulties.

  1. Getting an up-to-date SDK. Tao hasn't been updated since 2008. OpenTK hasn't had a stable release since June of 2010. OpenGL has had two version releases since June 2010. That's a lot of functionality you simply cannot access from C#. I don't know how stable OpenTK's nightlies are, but I generally don't trust nightlies. With C/C++, you can get whatever function pointers you want to load. With C#, you can only use what your toolkit provides.

  2. Dealing with buffer objects can be quite painful in C#. Yes, there are ways to upload arrays of uniform values to buffer objects. But building interleaved vertex data, where different components have different types, is much more difficult in C#. In C and C++, you have direct access to memory. So it's easy to have a 3-vector of floats followed by a 4-vector of bytes, all stored in 16 bytes per vertex. It's rather more difficult in C#.

  3. Graphics code is generally one of the more performance-critical areas of code. You will generally want the control that C++ affords if you're making a high-performance rendering application like a game. So many of C#'s nice features work against it here.

The only real advantage that using C# provides is that... it's C#. To the degree that you feel that advantages you, then it is an advantage.

like image 129
Nicol Bolas Avatar answered Sep 29 '22 06:09

Nicol Bolas