我们用于 WPF 方面的资源是 Charles Petzold 的关于该主题的著作。我们目前使用他图书馆中的东西。它让我们很快就开始了,但我们遇到了一些问题,所以我建议谨慎一些。然而,他网站上的东西值得一看。
We use both WPF and XNA for 3D rendering in the projects I'm currently working on. The XNA stuff is used from within a WPF application, so there is no problem using those two combined either.
I would use WPF for the 3D rendering if you have a simple scene since I like the abstraction it gives you. You simply add objects to the scene, set up some cameras and lights and the rest is handled for you. We use WPF for a visual editor containing up to ~500 cylinders without any performance problems. The one performance issue we have had is that it takes a long time to add/remove objects from the scene. So WPF is not a good fit if that is something you need to do a lot of.
However, if you have more complex needs or if the application is performance critical I would go with XNA to get closer to the metal. It gives you a more "classic", OpenGL like approach to rendering.
To summarize:
WPF:
Simple to use
Nice abstraction
Ok performance overall
Poor performance when adding/removing objects
XNA:
Close to the metal
Good performance
Feels more like OpenGL if you are used to that
Works with both WinForms and WPF
A resource that we have used for the WPF side of things is Charles Petzold's writings on the subject. We currently use stuff from his library. It got us started quickly, but we've had some issues, so I would recommend some caution. However, the stuff on his site is worth looking at.
Definetely XNA is faster and more convenient for extensive 3D work. WPF is fine for 3D, but XNA is easier to debug and offers several nice features, such as additive alpha blending and a Camera object. Also, you can find good libraries to support your work.
If you are not sure, then you should without doubt use an XNA object to draw the graphics. WPF will provide you with buttons and text, which, in turn, are a pain in XNA.
您可以按照 winforms 示例在 Windows 窗体中托管 xna,然后所有熟悉的控件(如下拉菜单和按钮)都将正常工作并与 xna 交互。
Xna will offer easier debugging of the 3d aspects.
You could follow the winforms example to host xna in a windows forms form and then all the familiar controls like drop downs and buttons will work fine and interact with xna.
发布评论
评论(3)
在我目前正在进行的项目中,我们同时使用 WPF 和 XNA 进行 3D 渲染。 XNA 的内容是在 WPF 应用程序中使用的,因此将这两者结合使用也没有问题。
如果您有一个简单的场景,我会使用 WPF 进行 3D 渲染,因为我喜欢它为您提供的抽象。您只需将对象添加到场景中,设置一些摄像机和灯光,其余的事情就会为您处理。我们使用 WPF 作为包含多达 500 个圆柱体的可视化编辑器,没有任何性能问题。我们遇到的一个性能问题是从场景中添加/删除对象需要很长时间。因此,如果您需要做很多事情,那么 WPF 不太适合。
但是,如果您有更复杂的需求或者应用程序对性能至关重要,我会选择 XNA 以更接近金属。它为您提供了一种更“经典”、类似 OpenGL 的渲染方法。
总结一下:
WPF:
XNA:
我们用于 WPF 方面的资源是 Charles Petzold 的关于该主题的著作。我们目前使用他图书馆中的东西。它让我们很快就开始了,但我们遇到了一些问题,所以我建议谨慎一些。然而,他网站上的东西值得一看。
We use both WPF and XNA for 3D rendering in the projects I'm currently working on. The XNA stuff is used from within a WPF application, so there is no problem using those two combined either.
I would use WPF for the 3D rendering if you have a simple scene since I like the abstraction it gives you. You simply add objects to the scene, set up some cameras and lights and the rest is handled for you. We use WPF for a visual editor containing up to ~500 cylinders without any performance problems. The one performance issue we have had is that it takes a long time to add/remove objects from the scene. So WPF is not a good fit if that is something you need to do a lot of.
However, if you have more complex needs or if the application is performance critical I would go with XNA to get closer to the metal. It gives you a more "classic", OpenGL like approach to rendering.
To summarize:
WPF:
XNA:
A resource that we have used for the WPF side of things is Charles Petzold's writings on the subject. We currently use stuff from his library. It got us started quickly, but we've had some issues, so I would recommend some caution. However, the stuff on his site is worth looking at.
XNA + WPF 是解决方案。本文将指导您完成该过程:http://www.codeproject。 com/Articles/38301/XNA-integration-inside-WPF
对于大量 3D 工作来说,XNA 无疑更快、更方便。 WPF 适合 3D,但 XNA 更易于调试,并提供了一些不错的功能,例如附加 alpha 混合和相机对象。此外,您还可以找到好的图书馆来支持您的工作。
如果您不确定,那么您无疑应该使用 XNA 对象来绘制图形。 WPF 将为您提供按钮和文本,而这在 XNA 中却是一种痛苦。
XNA + WPF is the solution. This article will guide you through the process: http://www.codeproject.com/Articles/38301/XNA-integration-inside-WPF
Definetely XNA is faster and more convenient for extensive 3D work. WPF is fine for 3D, but XNA is easier to debug and offers several nice features, such as additive alpha blending and a Camera object. Also, you can find good libraries to support your work.
If you are not sure, then you should without doubt use an XNA object to draw the graphics. WPF will provide you with buttons and text, which, in turn, are a pain in XNA.
Xna 将提供更轻松的 3d 方面调试。
您可以按照 winforms 示例在 Windows 窗体中托管 xna,然后所有熟悉的控件(如下拉菜单和按钮)都将正常工作并与 xna 交互。
Xna will offer easier debugging of the 3d aspects.
You could follow the winforms example to host xna in a windows forms form and then all the familiar controls like drop downs and buttons will work fine and interact with xna.