WPF 与 XNA 渲染数千个精灵 [英] WPF vs XNA to render thousands of sprites

查看:38
本文介绍了WPF 与 XNA 渲染数千个精灵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要渲染数千个用线条相互连接的椭圆.在 WPF 应用程序中呈现它的最佳方式(就性能而言)是什么.WPF Canvas 绘画比 XNA 绘画差很多吗?

I need to render thousand of ellipses linked each others with lines. What would be the best way (in terms of performances) to render it inside a WPF application. Is WPF Canvas painting a lot worse than XNA painting ?

实际上,隐藏的问题是:是否可以在 WPF 主机内进行一些 xna 渲染?我看到了一些使用无边框 xna 窗口覆盖的示例,但没有本机解决方案...

Actually, the hidden question is : is it possible to do some xna-rendering inside a WPF host ? I saw some examples that used a borderless xna window overlay, but no native soluation...

谢谢,奥雷连

推荐答案

如果处理得当,您可以在 WPF 渲染中获得相当高的性能,其优点是您不必承受 WPF-XNA 互操作的痛苦.如果使用 WPF 的低级渲染 API,例如 CompositionTarget.RenderingDrawingContext.您还可以利用新的 缓存合成功能.还有很多只是以此为起点.

If done right you can get some pretty high performance in WPF rendering which hast the advantage that you don't have to take the WPF-XNA interop pain. You can render (and animate) a very large amount of visuals if you use the low level rendering APIs of WPF such as CompositionTarget.Rendering and DrawingContext. You can also take take advantage of the new Cached Composition feature in .net 4.0. There is plenty more just take this as the starting point.

这篇关于WPF 与 XNA 渲染数千个精灵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆