将iPhone openGLES应用程序移植到OSX?

问题描述:

开发iPhone是我第一次使用objective-c和使用xcode的第一次体验。使用openGL将openGLES iPhone应用程序移植到OSX桌面有多困难?我不是问用户界面 - 显然没有等同于桌面上的可可触摸UI。我专门询问应用程序委托和openGLES层。是否有任何重大障碍?是简单的,只是在类型可可的项目中创建一个新的应用程序委托?

Developing for the iPhone has been my first experience with objective-c and first in-depth experience with xcode. How difficult would it be to port an openGLES iPhone app to the OSX desktop using openGL? I am not asking about user interface - obviously there is no equivalent to cocoa touch UI on the desktop. I am asking specifically about the app delegate and openGLES layers. Are there any major hurdles? Is it as straight forward as simply creating a new app delegate in a project of type cocoa?

只是相同的事情,看来OpenGL重型应用程序将是最容易退出到Mac的。几乎所有的OpenGL ES都在桌面上的OpenGL(除了一些固定点的东西),所以代码可以保持不变。

I've started looking into just the same thing, and it appears that OpenGL-heavy applications would be among the easiest to backport to the Mac. Pretty much everything in OpenGL ES is present in OpenGL on the desktop (with the exception of some of the fixed-point stuff), so that code can stay the same.

在iPhone上处理OpenGL的方式是通过核心动画层(CAEAGLLayer),而不是特定的视图。因此,您应该能够将其传输到基于Leopard的桌面应用程序,但是您需要将所有对EAGL类的引用转换为其OpenGL等效项(例如EAGLContext到NSOpenGLContext)。您可以将其转换为自己显示的CAOpenGLLayer,或者使用该层来回退自定义NSView。

The way that OpenGL is handled on the iPhone is via a Core Animation layer (CAEAGLLayer), rather than a specific view. Therefore, you should be able to transfer that across to a Leopard-based desktop application, although you'll need to convert all references to EAGL classes to their OpenGL equivalent (EAGLContext to NSOpenGLContext, for example). You could render into a CAOpenGLLayer that's displayed by itself, or use that layer to back a custom NSView.

桌面的基本结构Cocoa应用程序将不同于Cocoa触摸一个,但您应该能够从一个Xcode模板开始,并从Cocoa Touch应用程序中添加回您的组件。

The fundamental structure of a desktop Cocoa application will be different than a Cocoa Touch one, but you should be able to start from one of the Xcode templates and add back in your components from the Cocoa Touch application.

同样,我还没有为我的申请做这个,但它看起来相当简单。

Again, I haven't yet done this for my application, but it looks reasonably straightforward.