用什么? Tai、SharpGL、OpenTK、DirectX P/Invoke、XNA、MDX、SlimDX、Windows API 编解码器包

发布于 2024-10-15 19:59:11 字数 1431 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

夏尔 2024-10-22 19:59:11

我似乎已经登陆OpenTK。我认为它或多或少地提供了对 OpenGL API 的直接访问,并且不需要加载依赖项。

比较容易理解。它需要很少的(并且可以理解的)代码行来开始。它不为我保存对象,因此我可以自由地为每次传递更改任何内容,这很棒,因为我主要处理指向内存的不安全指针。

当然,将速度与易用性结合起来是很困难的。速度需要直接与 3D API 对话,而易用性需要抽象。因此,这必须被视为比我尝试过的其他一些 API 级别更低的 API。如果我想做一些预制角色动画,那么 XNA 可能是一个更好的选择,但对于我的使用(如上所述)来说,到目前为止这似乎非常有前途(4-5 小时的黑客攻击)。

一些示例代码:

private void Render()
{
   // Every frame
   GL.MatrixMode(MatrixMode.Modelview);
   GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
   GL.LoadMatrix(ref cameraMatrix);

   GL.Begin(BeginMode.Points);

   // Here I can add lots of points. I add 200k without any big problem.
   // It seems these points could have been passed in as an array pointer too,
   //  but I'll look at that later.
   GL.Vertex3(x2, y2, z2);

   GL.End();
   glControl.SwapBuffers();
}

I seem to have landed on OpenTK. I think it gives more or less direct access to the OpenGL API and doesn't require loads of dependencies.

It is comparatively easy to understand. It requires few (and understandable) lines of code to get started. It doesn't hold the objects for me so I'm free to change anything for each pass, which is great because I'm mainly working with unsafe pointers to memory.

It is of course difficult to combine speed with ease of use. Speed requires talking directly to the 3D API while ease of use requres abstraction. Therefore this must be considered a lower level API than some of the others I've tried. If I wanted to do some prefab character animation then XNA would probably be a better choice, but for my use (described above) this seems very promising so far (4-5 hours of hacking).

Some sample code:

private void Render()
{
   // Every frame
   GL.MatrixMode(MatrixMode.Modelview);
   GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
   GL.LoadMatrix(ref cameraMatrix);

   GL.Begin(BeginMode.Points);

   // Here I can add lots of points. I add 200k without any big problem.
   // It seems these points could have been passed in as an array pointer too,
   //  but I'll look at that later.
   GL.Vertex3(x2, y2, z2);

   GL.End();
   glControl.SwapBuffers();
}
夜访吸血鬼 2024-10-22 19:59:11

如果您喜欢 MDX,SlimDX 应该正适合您。它基本上是 MDX 的替代品,但修复了许多有问题的设计决策,并包含了更多功能。您在 MDX 中拥有的任何内容,都会以一种或另一种形式出现在 SlimDX 中。

If you liked MDX, SlimDX should be right up your alley. It's basically a replacement for MDX, but with a lot of the questionable design decisions fixed up, and a lot more functionality included. Anything you had with MDX, you will find present in SlimDX in one form or another.

夕色琉璃 2024-10-22 19:59:11

或者,还有另一个适用于 OpenGL 的 C# 包装器包:OpenGL DotNet。对我来说效果很好!请访问 https://github.com/luca-piccioni/OpenGL.Net .

它将 OpenGL 封装到 4.4 版并支持超过 550 个 OpenGL 扩展。它还支持 GLU、GLUT、FreeGLUT、DevIL(开发人员图像库)、ILU 和 DevIL 的 ILUT。

它是上述库的低级 API。

Alternatively there is another C# wrapper package for OpenGL: OpenGL DotNet. Works great for me! Check it out at https://github.com/luca-piccioni/OpenGL.Net .

It wraps OpenGL up to version 4.4 and supports over 550+ OpenGL Extensions. It also supports GLU, GLUT, FreeGLUT, DevIL (Developer's Image Library), ILU and ILUT for DevIL.

It a low level API for the above libraries.

木緿 2024-10-22 19:59:11

我们前段时间遇到过类似的问题,以下内容仅代表我们的意见。我们主要关心的问题之一是该库应该是多功能的,能够生成质量非常好的免费 3D 图像,并且不会对安装程序施加额外的限制,即像 XNA 一样,您必须安装正确的文件。这似乎是令人头痛的一个可能根源。最后我们选择了 DirectX 并用 C# 编写了 GUI。所有与 3D 所需的交互都是通过 wndproc 完成的。这为我们提供了 DirectX 的强大功能和使用 C# 进行 GUI 开发的便利性。我们对此一点也不后悔。

We faced a similar issue some time ago and the following represents our opinion only of course. One of our main concerns was that the library should be versatile, produce 3D images of very good quality, free, and not put loads of extra constraints on the installer, i.e. like with XNA where you have to have the correct files installed. This seemed like a possible source of headache. In the end we settled for DirectX and wrote the GUI in C#. All needed interaction with the 3D was done with wndproc. This provided us with both the power of DirectX and the ease of GUI development with C#. We haven't regretted this at all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文