Does cocoa limit the overall performance of a C/C++ openGL app?
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开发者_如何学C Blizzard use?
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.
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.
精彩评论