2

I have a project for the University to make a 3D application which does the following:

  1. A real physical object travels on a trajectory with recording hardware on it (3-axes accelerometers and gyros)
  2. My app gets the stored info from a file and generates a 3D model in a window recreating the trajectory of the real object over a surface - like a cube traveling and rotating in 3D space.

From searching the net and asking friends I found that I should use OpenGL (as the App should be usable on handheld devices after time). The question is what language should I use - C# or C++? I know that for gaming C++ is preferred (being faster and cheap on resources), but since this App is more like (if not exactly) a short 3D movie, not more than 2-3 minutes long, low on textures and objects, will there actually be a difference?

I'm more used to C# from doing recent projects and now when trying to get back to C++ I found it very difficult. So I do prefer C#, but if the benefits from C++ are worth it I will get back to it. On the other hand I'm very new to OpenGL and the concepts there are giving me a big headache.

Soner Gönül
  • 91,172
  • 101
  • 184
  • 324
mandarin
  • 1,048
  • 1
  • 12
  • 23
  • "What language should i use...?" is a question only you can answer. It's all about what you're comfortable with, really. – cHao Jan 03 '13 at 12:44
  • There is a similar question that contains some answers on what the difference is: http://stackoverflow.com/questions/8222138/what-advantages-exist-in-c-over-c-sharp-when-working-with-opengl Reading the answers there, most people seem to lean to C++. – Erik Schierboom Jan 03 '13 at 13:01
  • A friend of mine made a comparable program in C#, and that worked out just fine. It didn't really stress the CPU anyway so raw performance wasn't that much of a concern. – harold Jan 03 '13 at 13:19
  • "the App should be usable on handheld devices" What handheld devices? Find out whether you can compile C# or C++ code with OpenGL on these devices. That should give you your answer. – Samuel Harmer Jan 04 '13 at 08:39

3 Answers3

4

You should use C#. There is no point in using C++ if you're not comfortable with it and if you're not very familiar with the language then you won't be able to benefit from its performance.

Ben Voigt
  • 260,885
  • 36
  • 380
  • 671
Caesar
  • 8,395
  • 6
  • 34
  • 62
  • Are the speed improvements exponentially greater with C++ over C#, I hear anti-Microsoft peeps telling me the bad whilst ignoring the good of C# =) – Coops Jan 03 '13 at 12:47
  • @CodeBlend Nothing says that a well written C# application can't run as fast as C++. But C++ has some features that will blow C# out of the water interm of performance. – Caesar Jan 03 '13 at 12:49
  • 3
    This is a good rule to follow. Rarely in native vs .NET performance discussions is the point raised that C++ performance depends greatly on the expertise of the developer, but this is the one fact that explains all the different "head-to-head" performance results. Fact is, if you're asking SO to decide which language for you, you have no clue how to optimize a C++ application. – Ben Voigt Jan 03 '13 at 13:07
2

There will be no visible difference, especially since you won't be using lots of resources.

Denzil
  • 644
  • 8
  • 20
  • So the bigger the project or the larger the user base, the more relevant it becomes but potentially the longer it takes to code (without 3rd party tools / extensive c++ know-how)? – Coops Jan 03 '13 at 12:48
  • 1
    Possibly yes. My C++ knowledge, though existent is quite limited. However, since the C# runs on a VM it is inherently slower (assuming no important optimizations were made runtime). However, my point here is that the OP does not have to worry about language here at all since the app will be insignificantly small. – Denzil Jan 03 '13 at 12:51
2

Using C# along with something such as OpenTK would work well unless you are planning on rendering a massive amount of 3D meshes. If you are more familiar with C#, I would definitely take this route.

Additionally, since you are recording the physics of the object via onboard hardware vs. software simulation, the computational speed advantage of either language will be minimal.

Take a look at the sample gallery at OpenTK Gallery

Inisheer
  • 19,061
  • 9
  • 47
  • 81