OpenGL on Mac OS X for an iPhone developer
I'm looking for a good example of a basic OpenGL App for Mac OS X, but not too simple.
I have a good solid base of experience with iOS and objective-c, but I've never built a Mac OS X App.
All I've been able to find are super simple examples that do all the drawing and logic in drawRect: or overly complex example开发者_JS百科s with layers and layers of abstraction. I don't want to use Glut, SDL, or any other 3rd party libs or engines.
I want to be able to drive a Game Loop and use CADisplayLink like I do on my iOS games. I'd also rather not use .xib files because I like to understand what's going on and having that black box there hides too much for me, although I'd be happy to use it as a first step if it got me everything else (game loop, CADisplayLink, etc).
My iOS code creates it's OpenGL Views by hand, but there seems to be enough of a difference between iOS and OS X that I'm having trouble making heads or tails of it. I just need to get a Window and an OpenGL view and be able to draw to that via the game loop.
Can someone point me to a good resource? The Apples examples jump between to simple and too complex as does everything else I can find on the Internet.
Sorry I can't answer to your questions. I always did use XIB files (a looong time ago, I too always wanted to re-invent the wheel, but now I'm lazy and prefer getting stuff done :p) and I never used display links.
What don't you like about overriding drawRect: ?
And the sample I used to get started with OpenGL was this one : http://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004501
Not too complicated, and simple enough to understand it (and it doesn't use any XIB, if I remember well :p)
精彩评论