what lang for dx9?

Started by
4 comments, last by pontifikas 18 years, 8 months ago
I am jsut switching over from openGL use, for a change of scene (plus it bothers me that I have heard so much about batching already and for Opengl that is prety much useless knowledge). I am wondering whether to start learning the dx9 api using c# or c++. I am proficient in c++ and I like the access to the memory + pointers + deterministic destructor calling. However it seems that managed dx9 will clear up a bunch of the clutter from writing a dx9 app, so maybe c# would be the way to go. Also I have been enjoying writing java code more recently than before, and it always comes out looking cleaner than c++ code, so maybe learning c# would be a good idea.
¿We Create World?
Advertisement
Hi,

I've been coding dx in c++ only, so my opinion might be useless, but anyway:
-I've helped some people coding dx in c# and the documentation seemed to be not that complete as the c++ docs.
-you'll find tons of tutorials and sample codes for c++, but way less for managed dx
-somebody told me that he coded the same thing using dx with c++ and managed dx with c# and the FPS was only the half, but i'm not sure about this

anyway, learning c# could be a good idea, but I prefer c++ for speed reasons

kp

------------------------------------------------------------Neo, the Matrix should be 16-byte aligned for better performance!
For beginniners who know neither C++ or C#, I usually recommend C#, because it's just that much easier. However, since you are already proficient in C++, you may just want to stay with unmanaged C++. M

DX clears up some stuff, but you should still be deleting your own resources and such (just because it will eventually clean them up for you doesn't mean that you shouldn't do it yourself). In my current project, I have a ResourceManager that handles absolutely all of the releasing, but I still release all interfaces manually. It's more of a backup than anything.

Also, for someone new to DX, C++ may be easier, because there are a lot more resources out there available to you (like kovascp mentioned). Of course, the docs, samples, and tutorials for MDX are still growing.

Quote:somebody told me that he coded the same thing using dx with c++ and managed dx with c# and the FPS was only the half, but i'm not sure about this

I seriously doubt this. Microsoft has publically benchmarked C#/MDX to be at about 97% of the speed of C++/NDX. It must have been a really terrible app [lol]

Which reminds me - C# and ManagedDX do have some tricky caveats that you must be careful of. It is advertised to be "code it and go", but there are something things that you have to look out for (check out the docs first, some aren't obvious).
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
When I first started out on C#, I did a direct port (as in no design changes) or my C++ graphics renderer to C#. I noticed somewhere between 5-10% speed drop of the C# version after the port. This was before I really understood how to code efficiently in C#, so the real difference is probably less.

That being said, I find myself writing programs in (very, very approximately) 70% the time it would have taken to write them in C++. I can then use that 30% time I save to optimize the program, which usually leads to far more efficient programs than I could have written in the same amount of time with C++.

So yes, C++ is technically a little bit faster in benchmarks, but realistically the additional time one has to optimize (or do whatever else you want) more than makes up the difference.
If you are stupid about your code and don't take into accounts the differences i the lanbguages, MDX can seem much slower. If you don't pay attention, you start running into problemns like "boxing" (converting a structure to an object) and .NET will start swapping tons of data between the stack and heap, which can potentially slow down an app quite a bit...

[Edited by - Sr_Guapo on August 7, 2005 2:31:46 AM]
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
Stick with what you are familiar with.

In my case C# was the key. The main advantage is that it is a much "cleaner" language, and provides fast development( A lazy C++ I've heard).

As for resource managment,in general,if you are the type of guy who depends on the Garbagge Collector, then you have a philosophy problem.
-----------------------------Dev.Enviroment:VS 2005 Language:C#GfxLib:DirectX(preferably),OpenGL.Ability:Damn Noob!

This topic is closed to new replies.

Advertisement