背景
据我所知,WPF 如果可能的话,会进行硬件加速绘图,并回退到如果用户没有 DirectX 9+,则使用软件渲染。这是一个非常有趣的想法,我什至喜欢 XAML 的想法。
我不喜欢它的原因,以及我什至懒得学习它的原因是,虽然 Windows Forms是微软的技术,比WPF差,它通过Mono,这对于 WPF 来说是不正确的,而且可能永远不会如此。
关于 Linux/OS X 的 .NET WinForms 包装器是否会受到攻击,存在争论未来的专利砖墙,但这超出了这个问题的范围。
问题
是否有任何用于 .NET 和 Mono 的库可以让我使用基本的硬件加速< /strong>(考虑 Alpha 合成、快速像素操作等),为没有所需 GPU/驱动程序的系统提供软件后备?
简而言之:在非古代台式机和现代笔记本电脑上快速图形,但在低端上网本和类似设备。 这不适用于游戏开发。
进一步说明
有几个技巧可以使 GDI+ 更快。 原始指针访问.
使用的像素格式可以极大地提高渲染效果,32bppPArgb (32 位,带有 8 位 Alpha 和 RGB 值 预乘 alpha)。
还有其他 技巧可以获得更快的速度,但可以管理对于某些用途来说,GDI+ 仍然很慢。
我知道的框架
我当前的选择是尝试 Irrlicht,但这只是因为我别无选择。有吗?
此外,尽管它似乎支持软件渲染,但我不知道它在 .NET 中的状态如何/Mono 包装器,其支持链接是 论坛帖子。
目前没有。
此外还有一个进一步的问题:我不知道如何围绕图形库“抽象”。如果后来我意识到自己做出了错误的选择,我将不知道该怎么办。
请原谅这个问题的长度。
编辑:由于这个问题有两个真正有建设性的答案,我会等待几天并勾选最高票数的答案作为接受的答案。
在另一则新闻中,OpenGL 似乎是在软件中实现的,既由操作系统供应商也由第三方实现,并且这些在缺乏第三方驱动程序的情况下,OpenGL 框架将使用该实现。
Background
As far as I know, WPF does hardware-accelerated drawing if possible, with a fallback to software rendering if the user does not have DirectX 9+. That is a very interesting idea, and I even like the idea of XAML.
The reason I don't like it, and why I didn't even bother learning it, is that while Windows Forms is a Microsoft technology, and inferior to WPF, it is cross-platform through Mono, something that's not true for WPF, and probably will never be.
There's debate around whether a .NET WinForms wrapper for Linux/OS X will hit a patent brick wall in the future, but that's outside of the scope of this question.
Question
Is there any library for .NET and Mono that will let me use basic hardware acceleration (think alpha compositing, fast pixel manipulation, etc) with a software fallback for systems without the required GPUs/drivers?
In short: fast graphics on non-ancient desktops and modern laptops, but usable graphics on low-end netbooks and similar devices. This is not for game development.
Further Notes
There are several tricks to make GDI+ faster. Set/GetPixel are much improved by raw pointer access.
The pixel format used can improve rendering greatly, 32bppPArgb (32-bit with 8-bit Alpha and RGB values Pre-multiplied by the alpha).
There are other tricks that can get faster speeds, but managed GDI+ is still slow for some purposes.
Frameworks I'm Aware Of
- Unity3D -
AFAIK does not support Mono. Does. Shareware with free version.
- TAO Framework - Looks a bit complicated, and does not seem to support sofware rendering.
- OpenTK - Active, well-developed, and better than TAO, but no software fallback either.
- SDL.NET - Same problem as above.
- MonoXNA - Same as above.
- Irrlicht - "It is completely cross-platform, using D3D, OpenGL and its own software renderer".
- Silverlight/Moonlight - Suggested by dthorpe. Alpha quality, no support whatsoever.
- Mono.Cairo - Suggested by Mark H.
- AGG - High quality, very efficient software rendering, implemented in C++ with an unofficial C# port.
- Axiom3D - Ogre port. Supports Mono, open-source and seems alive. Promising.
My current choice is to try Irrlicht, but only because I see no alternative. Is there?
Besides, even though it seems to support software rendering, I don't know how's the state of it in it's .NET/Mono wrapper, and the support link of it is a forum post.
none at the moment.
Besides there is a further problem: I have no idea how to "abstract" around a graphics library. If further on I realize I've made the wrong choice, I won't know what to do.
Please excuse the length of this question.
Edit: Since this question had two really constructive answers, I'll wait some days and tick the most upvoted one as the accepted answer.
In another news, it seems OpenGL is implemented in software, both by OS vendors as by third parties, and these implementations will be used by OpenGL frameworks in the lack of third party drivers.
发布评论
评论(3)
开罗怎么样?它有多个后端,包括 OpenGL、GDI、X 和 Quartz,并且几乎可以在任何设备上运行。 Mono.Cairo 为其实现了 .NET 包装器,但我不确定这是否允许通过切换后端代码,或者是否需要为每个系统重建。
Cairo 用作 Moonlight、Gtk+ 和 Mono 的 System.Drawing 实现的后端。
How about cairo? It has multiple back-ends, including OpenGL, GDI, X, and Quartz, and should work on nearly any device. Mono.Cairo implements a .NET wrapper for it, but I'm unsure whether this allows switching back-end through code, or whether it requires rebuilding for each system.
Cairo is used as the back-end for Moonlight, Gtk+, and Mono's System.Drawing implementation.
您的阵容中未提及的一个框架集是 Silverlight。它在 Windows 上进行了硬件加速,Moonlight 现在在 Linux 上进行了硬件加速。不确定软件后备,但我想它们必须有后备,因为它们都是为非常广泛的消费者使用而设计的。
One framework set not mentioned in your lineup is Silverlight. It's hardware accelerated on Windows, and Moonlight is now hardware accelerated on Linux. Not sure about software fallback, but I imagine they have to have fallback since they were both designed for very broad consumer use.
OpenTK 怎么样,然后使用 http://www.mesa3d.org/?我已经很久没有关注 mesa3d 了,但它为 OpenGL 提供了软件渲染功能。
How about OpenTK but then using http://www.mesa3d.org/? It's been a long time since I looked at mesa3d but it provides a software-rendering capability to OpenGL.