Some of Objective-C is inevitable if you want to take advantage of the latest OSX / Cocoa benefits. The easiest way to port an existing application on MacOS is as follows:
- Write a boneless headless application in Objective-C. This will be only one AppDelegate class and a little tweak in the main () function
- Add a custom NSGLView downstream to your window, which you create in the AppDelegate doneFinishLaunching event handler
- Configuring CVDisplayLink and render callback in NSGLView initialization
- Use existing OpenGL rendering code in CVDisplayLink callback
Now for the interesting part: where to get all this?
Surprisingly, a good example of a nibless application is the interface for the QEMU OSX port (yes, an emulator). Also, Apple's official GLEssenstialPractices demo shows you all the information you need to set up your OpenGL rendering pipeline. Everything else is up to you.
A detailed and up-to-date introduction to OSX system programming can be found in Mark Dalrimple's book, Advanced Mac OS X Programming. This explains a lot of things, and after reading all this I understood most of the design decisions in the OS (it really makes you accept all the “non-standard” things if you think in terms of performance).
To get through the "nibless" programming, I would recommend you read blog entries like this http://blog.kleymeyer.com/2008/05/creating-cocoa-applications-programatically-ie-nib-less/ google search helps many.
The same tricks apply to CocoaTouch / iOS, and there are many questions on SO like this Cocoa touch / Xcode - creating a graphical context without NIB
source share