I needed to show a demo of my game to some one who has a Mac, but no iPhone. There are two ways you can do this:
- Just run the iPhone game via the emulator. This is quite messy because you need to get a non technical person to download and install xcode and install the game in the correct directory.
- The second way is to actually port the code to OS X. This turned out to be easier than expected, thanks to the fact that the game is already built to be portable, mainly using OpenGL ES and OpenAL.
The secret here is to use GLUT. I started by making a blank GLUT project using these instructions. Then, I converted my touch handling code using glutMouseFunc and glutMotionFunc. Using GLUT is actually a lot simpler than the standard OpenGL initialisation code used in EAGLView.
Then, I had to convert my PVR textures to normal textures. (Funnily enough the PVR code compiles fine – but obviously does not run). Finally, OpenGL functions ending with ‘x’ have to be changed to ‘i’, e.g.: glTexParameterx becomes glTexParameteri. Also, glOrthof becomes glOrtho and glFrustumf becomes glFrustum.
I didn’t need to make any changes at all to OpenAL, that just worked.