使用OpenGL时,C ++在C#中存在哪些优点 [英] What advantages exist in C++ over C# when working with OpenGL

查看:176
本文介绍了使用OpenGL时,C ++在C#中存在哪些优点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在OpenGL中获得感兴趣的学习,我试图找出在学习过程中使用哪种语言的最佳方向。我已经非常熟悉C#,从我已经阅读,我可以利用Tao API与C#代码的OpenGL接口。但是,我从我正在读的东西似乎是真正专业的OpenGL开发人员是C ++程序员。

I am starting to get interested learning in OpenGL and I am trying to figure out what the best direction to go as far as which language to use in the learning process. I am already very familiar with C# and from what I have read, I can utilize the Tao API to interface with OpenGL from C# code. However, it also seems to me from what I'm reading that those who are really professional OpenGL developers are C++ programmers.

我很好奇C ++可能有什么优势C#在OpenGL中使用3D图形。任何输入将是伟大的,因为我是一个完整的newby在所有这一切。

I'm curious what advantages C++ might have over C# when working with 3D graphics in OpenGL. Any input would be great as I'm a complete newby at all this.

推荐答案

使用OpenGL通过C#有一些困难。 / p>

Using OpenGL via C# has some difficulties.


  1. 获取最新的SDK。 Tao自2008年以来没有更新。OpenTK自2010年6月以来没有稳定版本。从2010年6月以来,OpenGL已经有两个版本。这是很多功能,你根本无法从C# 。我不知道OpenTK的夜总会有多稳定,但我一般不相信夜总会。使用C / C ++,你可以得到任何你想加载的函数指针。使用C#,你只能使用你的工具包提供的。

  1. Getting an up-to-date SDK. Tao hasn't been updated since 2008. OpenTK hasn't had a stable release since June of 2010. OpenGL has had two version releases since June 2010. That's a lot of functionality you simply cannot access from C#. I don't know how stable OpenTK's nightlies are, but I generally don't trust nightlies. With C/C++, you can get whatever function pointers you want to load. With C#, you can only use what your toolkit provides.

在C#中处理缓冲区对象可能会很痛苦。是的,有办法将统一值的数组上传到缓冲区对象。但是构建交织的顶点数据,其中不同的组件具有不同的类型,在C#中要困难得多。在C和C ++中,您可以直接访问内存。所以很容易有一个3向量的浮点数,后面跟一个4个字节的向量,每个顶点存储16个字节。在C#中更难。

Dealing with buffer objects can be quite painful in C#. Yes, there are ways to upload arrays of uniform values to buffer objects. But building interleaved vertex data, where different components have different types, is much more difficult in C#. In C and C++, you have direct access to memory. So it's easy to have a 3-vector of floats followed by a 4-vector of bytes, all stored in 16 bytes per vertex. It's rather more difficult in C#.

图形代码通常是性能更为关键的代码区域之一。如果你正在做一个高性能的渲染应用程序,如游戏,你通常会想要C ++提供的控制。

Graphics code is generally one of the more performance-critical areas of code. You will generally want the control that C++ affords if you're making a high-performance rendering application like a game. So many of C#'s nice features work against it here.

使用C#提供的唯一真正的优势是。它是C#。在你觉得优势你的程度,那么它是一个优势。

The only real advantage that using C# provides is that... it's C#. To the degree that you feel that advantages you, then it is an advantage.

这篇关于使用OpenGL时,C ++在C#中存在哪些优点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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