可可是否会限制 C/C++ 的整体性能? openGL 应用程序?
我正在寻找在 Macintosh 上编写第一个 OpenGL 应用程序。以前我只在 Windows 中进行过 OpenGL 编程。根据我的阅读,基本上有三种选择
: 可可 Carbon
Glut 是不可能的,因为我不喜欢它的外观,而且从我读到的内容来看,很大一部分 Carbon 已被弃用。现在,关于 Cocoa:
这里有一篇文章: 纯 C 中的 Cocoa OpenGL 窗口?提到 Cocoa 将您限制为单个线程。这是整个应用程序的单个线程,还是窗口管理的单个线程?我是否会被禁止在 C/C++ 本身中进行多线程编程?
此外,可可会让你放慢速度吗?暴雪使用什么样的窗口管理?
I'm looking to write a first OpenGL app on the Macintosh. Previously I've only done OpenGL programming in Windows. From what I've read, there are basically three choices:
Glut
Cocoa
Carbon
Glut is out of the question because I do not like the look of it, and from what I have read, a good share of Carbon is deprecated. Now, regarding Cocoa:
A post here: Cocoa OpenGL window in pure C? mentions that Cocoa limits you to a single thread. Is that a single thread for the entire application, or a single thread for the window management? Would I be prohibited from doing multi-threaded programming from within C/C++ itself?
Further, does Cocoa slow you down? What kind of window management does Blizzard use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
大多数“纯C”框架(包括SDL)仍然使用Objective-C 和Cocoa 来创建和管理OpenGL 窗口。您不应该对整个应用程序中的少量 Objective-C 感到压力。您可以在 Objective-C 中完成最低限度的工作,并在 C 中构建应用程序的其余部分。使用 Cocoa 符合您的最佳利益,因为随着时间的推移,支持正在不断改进。如果您使用 Carbon,随着时间的推移,支撑会恶化,直到突然完全消失。
你对过剩的看法是对的。避开。有很多优秀的框架。 GLUT 有利于 OpenGL 教育,仅此而已。
您将不会受到使用多线程的限制。您在其他讨论中看到的线程讨论指的是所有 OpenGL 调用必须如何从“主线程”发生。换句话说,一旦创建了一个新线程,就无法从该新线程进行 OpenGL 调用,因为上下文一次只能在一个线程中处于活动状态。 (有些调用使上下文在另一个线程中处于活动状态,但要点是您仍然只能在一个线程中工作。)但是,程序的其余部分可以有多个线程,没有问题。
简而言之,不会,你的表现不会被任意限制。
Most "pure C" frameworks (including SDL) still use Objective-C and Cocoa to create and manage the OpenGL window. You should not stress over a small amount of Objective-C in your overall application. You can do the bare minimum in Objective-C and build the rest of the application in C. It is in your best interest to use Cocoa because support is improving as time goes on. If you use Carbon, support will worsen over time until suddenly it is flat out removed.
You are right about GLUT. Steer clear. There are plenty of superior frameworks. GLUT is good for OpenGL education, and that's it.
You will not be restricted from using multiple threads. The discussion of threads you see in that other discussion refer to how all OpenGL calls must happen from "the main thread". In other words, once you create a new thread, you cannot make OpenGL calls from that new thread because the context can only be active in one thread at a time. (There are calls to make the context active in another thread, but the point stands that you still can only work in one thread.) However, the rest of your program can have multiple threads no problem.
In short, no, your performance will not be arbitrarily restricted.
这不是 Cocoa 的限制。我所知道的所有 OpenGL 实现都只允许您与主线程上的 OpenGL 上下文进行交互。
暴雪肯定只是打开一个窗口作为全屏 OpenGL 上下文并在其中进行绘制。
可可不会让你放慢脚步。
That's not a limitation of Cocoa. All OpenGL implementations I'm aware of only allow you to interact with the OpenGL context on the main thread.
Blizzard surely just opens a window as a full screen OpenGL context and draws within that.
Cocoa is not going to slow you down.