本文介绍了的DirectX或OpenGL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你是用C#编写的下一个3D图形密集型应用程序(如3D建模和动画软件),哪一个会是更好的选择?

If you were writing the next 3d graphics intensive application in C# (like a 3d modelling and animation software), which one would be a better choice?

如果我们考虑C#作为平台无关,然后OpenGL的似乎很诱人,但对于性能等?

If we consider C# as platform independent, then OpenGL seems tempting, but what about the performance, etc?

由于所使用的语言是C#,表现为pretty的重要考虑。

Since the used language is C#, the performance is pretty crucial to consider.

编辑:您还可以考虑SlimDX和陶,OpenTK,CSGL,等过

You can also consider SlimDX and TAO, OpenTK, csGL, etc too.

推荐答案

在管理code,相对于图形子系统的性能,也不错。 SlimDX支付略微超过点球每次调用到DirectX的完全本土code,但它绝不是严重的。实际的处罚取决于呼叫 - 呼叫到的DrawPrimitive将大大比较贵总体上比调用SetRenderState,让百分比明智,你最终失去了很多的SetRenderState电话。 SlimDX集成了调谐数学库,通常表现得非常好,但你必须要小心一点吧。分析,即使有勇克工具如NProf,突出了这个东西非常快,所以它不是很难解决。

Performance in managed code, with respect to the graphics subsystem, is not bad. SlimDX pays a slightly penalty over completely native code on each call into DirectX, but it is by no means severe. The actual penalty depends on the call -- a call into DrawPrimitive will be vastly more expensive overall than a call to SetRenderState, so percentage-wise you end up losing a lot more on the SetRenderState calls. SlimDX incorporates a tuned math library that generally performs very well, although you have to be a bit careful with it. Profiling, even with a junker tool like NProf, highlights this stuff very quickly so it's not difficult to fix.

总之,如果我们考虑到通用性,的完全优化的C ++和C#code做通过D3D渲染,C#版本可能是内部的C ++版本10-15%。这是很难达到的,虽然;考虑多少时间,要保存在其中,你可以申请,你可能根本就没有时间,如果你有来构建整个事情在C ++中更高级别的图形优化C#的工作。而且,即使你设法在C ++中,额外的10%,它会迅速缩水至5%的几个月内,当通过应用程序code新一轮的硬件眼泪比以往更快。我知道我会挑 - 这就是为什么我写SlimDX开始与

Overall, if we consider generic, completely optimal C++ and C# code doing rendering via D3D, the C# version is probably within 10-15% of the C++ version. That's hard to achieve though; consider how much time you're saving by working in C# which you can apply to higher level graphics optimizations that you probably simply wouldn't have time for if you had to build the entire thing in C++. And even if you managed to get that extra 10% in C++, it'd promptly shrink to 5% within a few months, when a new round of hardware tears through your application code faster than ever. I know what I'd pick -- which is why I wrote SlimDX to begin with.

OpenTK受到类似的性能特点,需要提醒的是他们的数学库的地方相当缓慢。这是我与他们讨论了执行错误,并在不久将有望得到解决。

OpenTK is subject to similar performance characteristics, with the caveat that their math library is rather slow in places. This is an implementation bug that I've discussed with them, and will hopefully be fixed before too long.

这篇关于的DirectX或OpenGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 23:45