面向 iPhone 开发人员的 Mac OS X 上的 OpenGL
我正在寻找一个适用于 Mac OS X 的基本 OpenGL 应用程序的好示例,但不是太简单。
我在 iOS 和 Objective-C 方面拥有丰富的经验,但我从未构建过 Mac OS X 应用程序。
我所能找到的都是超级简单的示例,它们在drawRect:中完成所有绘图和逻辑:或者具有层层抽象的过于复杂的示例。我不想使用 Glut、SDL 或任何其他第 3 方库或引擎。
我希望能够像在 iOS 游戏中一样驱动游戏循环并使用 CADisplayLink。我也不想使用 .xib 文件,因为我喜欢了解正在发生的事情,并且那里的黑匣子对我来说隐藏了太多内容,尽管如果它为我提供了其他一切,我很乐意将其用作第一步(游戏循环、CADisplayLink 等)。
我的 iOS 代码手动创建了 OpenGL 视图,但 iOS 和 OS X 之间似乎有足够的差异,我很难搞清楚它的情况。我只需要获得一个窗口和一个 OpenGL 视图,并能够通过游戏循环进行绘制。
有人能给我指出一个好的资源吗?苹果的例子在简单和过于复杂之间跳跃,就像我在互联网上找到的其他所有例子一样。
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 examples 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉我无法回答你的问题。我总是使用 XIB 文件(很久以前,我也一直想重新发明轮子,但现在我很懒,更喜欢完成工作:p)并且我从未使用过显示链接。
您不喜欢重写drawRect: 的哪些方面?
我用来开始使用 OpenGL 的示例是这样的: http://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004501
不太复杂,也很简单足以理解它(并且它不使用任何 XIB,如果我没记错的话:p)
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)