OS X/Xcode Questions

TheGeek

Golden Member
Jun 6, 2004
1,090
1
0
I just started programming for OS X using Cocoa. I am coming from Win32, so it is pretty different. I ported an OpenGL project over to Cocoa by subclassing the OpenGL view and then extern-ing my C++ OpenGL code so that my Objective-C class can use my functions. That works fine. I have a few questions related to OpenGL/Xcode/Cocoa. BTW, I am going to school for game development, so thats why I'm only interested in OpenGL and not just normal applications.

1. How can I get keyboard and mouse input in my program? I dont want buttons or anything, I want to be able to get it from within an OpenGL view. In Win32 I would use either DirectInput or just GetAsyncKeyState().
2. Is there a way to get input in C++ with the way I am doing it?
3. Is there an Objective-C interface to OpenGL?
4. Does Xcode always require absolute paths to files? I am use to using VS2005 which can use relative paths for all files, whereas in Xcode/OpenGL I can only seem to get a file loaded if I use its absolute path, which is rather frustrating.
5. Is there a global way to set an include directory, like you can in VS2005? I have a bunch of utility and helpful files that I have made and it's a pain in the ass to have to set each project to look in the same directory for headers.

I think that is about it for now. I will probably have more as time goes on. Thanks a lot in advance for any replies.
 

programmer

Senior member
Mar 12, 2003
412
0
0
Not sure if I can answer all your questions, as most of the code I've written for the Mac the last few months has been BSD or Carbon, very little Cocoa. But I was fortunate to recently be in a Cocoa Programming course taught by Aaron Hillegass himself. My advice -- buy his book ("Cocoa Programming for Mac OS X")!

http://www.bignerdranch.com/products.shtml

Also buy the other book (Advanced Mac OS X Programming). It is less Cocoa and more Mac OS X platform and also an excellent source of info.

The Apple developer site has FANTASTIC info, and tons of it... For example, see the Cocoa OpenGL sample at http://developer.apple.com/sam...ocoa_OpenGL/index.html... and this document should be comprehensive on OpenGL:
https://developer.apple.com/do...apter_1_section_1.html


More advice: for Cocoa, stick with Objective-C as much as possible instead of C++.

I believe the next version of the Xcode libs may support a Cocoa interface to OpenGL too.

Enjoy!