简体   繁体   English

我应该在VB.Net中使用哪种技术来制作2D图形? WPF,DirectX,SlimDX?

[英]What technology should I use for 2d graphics in VB.Net? WPF, DirectX, SlimDX?

I recently got hired to help write some computer based vision tests and most of the code is being written in VB.Net. 最近,我被雇用来帮助编写一些基于计算机的视觉测试,并且大多数代码都在VB.Net中编写。 I personally think it would be better to write it in c++ but I think that ship has already sailed. 我个人认为用c ++编写它会更好,但是我认为那艘船已经航行了。 Most of the tests are fairly simple graphically for example the depth perception test is just three gray/silver bars on a black background and the middle bar can be made to appear popped in or out using nvidia 3D glasses. 大多数测试在图形上都是相当简单的,例如,深度感知测试只是黑色背景上的三个灰色/银色条,而使用nvidia 3D眼镜可以使中间条看起来像是弹出或弹出。 The other tests are different but in general involve simple 2d graphics. 其他测试不同,但通常涉及简单的2d图形。 My understanding is the there is no DirectX support for managed languages after DX9. 我的理解是,DX9之后不存在对托管语言的DirectX支持。 I know I could use XNA but I would rather not make the end customers have to download the XNA installer. 我知道我可以使用XNA,但我不想让最终客户不得不下载XNA安装程序。 I was thinking about using WPT but my understanding is that WPF is based on vector graphics and that one WPF Pixel is not necessarily a true pixel. 我当时在考虑使用WPT,但我的理解是WPF基于矢量图形,并且一个WPF像素不一定是真正的像素。 I need to have very precise control over the spacing of objects down to the pixel so that the tests are accurate. 我需要对对象到像素的间距进行非常精确的控制,以便测试准确。 I guess my question boils down to whether I should use an old version of DX9 a or b, or should I use a DX wrapper like slimDX. 我的问题归结为应该使用旧版本的DX9 a还是b,还是应该使用诸如slimDX之类的DX包装器。 The last thought I had was to create a windows application control in c++ and directX for the graphics aspects of each test and then use that control in my vb.net app if that is possible. 我的最后一个想法是在c ++和directX中为每个测试的图形方面创建Windows应用程序控件,然后在可能的情况下在vb.net应用程序中使用该控件。 Any ideas would be welcomed. 任何想法都将受到欢迎。

UPDATE: The OP has clarified that he wants to use an API that supports NVidia 3D Vision 更新:OP明确表示他想使用支持NVidia 3D Vision的API

SlimDX is a C# wrapper for DirectX, and is very complete. SlimDX是DirectX的C#包装器,非常完整。 In fact - here's a related SO post on using SlimDX for NVidia 3D: Nvidia 3d Video using DirectX11 and SlimDX in C# (if you read the followup, you'll see the poster got it working in DX9) 实际上-这是有关将SlimDX用于NVidia 3D的相关SO帖子: 在C#中使用DirectX11和SlimDX的Nvidia 3d Video (如果阅读了后续内容,您将看到海报使它在DX9中工作)

For the 2D-only portions, WinForms/GDI+ is a good match, however you could also just code the entire thing using SlimDX since you've already got it available. 对于仅2D的部分,WinForms / GDI +非常适合,但是您也可以使用SlimDX对其进行编码,因为您已经可以使用它了。

GDI+: - 2D Graphics API - You can work in C# (closer to your desired C++) and integrate with the legacy VB.Net - Pixel-level control GDI +:-2D图形API-您可以在C#中工作(更接近所需的C ++)并与旧版VB.Net集成-像素级控件

The only down-side of GDI+ is that it is slow, relative to GPU accelerated 3D libs like DX and OpenGL, but honestly, this will not be noticeable unless you are pushing many megapixels, and have high frame rate requirements. 与DX和OpenGL等GPU加速的3D库相比,GDI +的唯一缺点是速度较慢,但​​是老实说,除非您推动许多百万像素并且具有很高的帧速率要求,否则这不会引起注意。

You are correct that Managed DirectX stopped at DX9 (and is only available for x86 targets). 您已确定Managed DirectX停止在DX9(仅适用于x86目标)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM