I want to open an OpenGL window ( to display and grab keystrokes / mouse events ) in MacOSX.
I don't want to use Glut (since it demandds it be the root thread).
I don't want to learn Objective C.
Is there anyway to access the OpenGL api in pure C?
Thanks!
If you want to grab events on OS X, there are a couple options:
Objective C is a very small set of additions to pure C code. You don't have to learn much of it to get by using the Cocoa API. It's not at all the beast that is C++. If you know C, you can learn all you need in a couple hours. All of the best sample code and documentation on the web is for Cocoa, not Carbon. There's OpenGL sample code galore that uses Cocoa, all over the web and on Apple's dev website.
However, all the event handling has to go in the main thread regardless of the API you use. That's the purpose of the main thread, no? You can do OpenGL calls in any thread you like, of course.
I ended up using GLFW.
At first, keyboard events do not work; but they have a sample script for building a bundle. After that, flawless.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With