Archived

This topic is now archived and is closed to further replies.

Cyber_Sneak

Porting to mac

Recommended Posts


  1. Identify and handle any situations where endian-ness comes up. This potentially includes any time you interact with files and sockets among other things.

  2. Ensure that your code is standards-compliant enough to be ported to the common MacOS X compiler. The default MacOS X compiler is a modified version of GCC, so find a version of GCC for Windows (MinGW and Cygwin are two common distributions).

  3. Rewrite any Windows-specific code.

    • Initialization code can often be entirely replaced by something like SDL if you want an easy way out. Otherwise, you''ll need to learn how MacOS X handles it natively and wrap it all in a preprocessor dealie or something similar.

    • Any wgl function usaged needs to be removed or reimplemented differently.

    • Little things like OpenGL headers will need to be changed too. You can rely on SDL for this too, if you''d like (it supplies a SDL_opengl.h). MacOS X supplies OpenGL/gl.h and OpenGL/glu.h for its OpenGL headers.

    • Tip: MacOS X environments should define __APPLE__ and __MACH__ macros, which you can rely on to have the preprocessor modify your code as you need it to for MacOS X.




Much of that can be done before even trying to compile it on a Mac, which saves you some work. If you go the SDL route, you''ll have potential portability to many other platforms available afterward in addition to MacOS X.

Share this post


Link to post
Share on other sites
Wow, what a thorough explanation!

I'd think SDL would solve much of your woes. In the case of OpenGL, it would serve mainly as a windowing client to create platform-independent OpenGL windows, and a platform-independent input handler. The code to do so is EXTREMELY small.

Also, you would have the benefit of using the many platform-independent libraries that use SDL, such as SDL_image. Never worry about loading a 2d graphic file format again by using SDL_image


daveandrews.org - a Christian Programmer's Weblog

[edited by - Ronin Magus on October 23, 2003 7:12:55 PM]

Share this post


Link to post
Share on other sites
Whee, I spent 3 hours doing this today, taking the Enginuity code base across to OSX

Assuming you''re talking about OSX - previous OSes are both a completely different kettle of fish, and a pain in the arse, so TBH I wouldn''t bother with them - then you''ll probably be using Project Builder (unless you''re lucky enough to have Jaguar already, in which case you might be using XCode).

It''s not *too* hard to set up an OpenGL environment yourself under MacOSX - at least, not in a window (never done it fullscreen myself). You can use the interface builder to simply drag and drop an ''OpenGL view'' into a window, and then hook it to do your drawing. Very quick, but you should be prepared to delve into a little Objective-C if you want total control.

Otherwise, yeah, SDL is good. It would also allow you to convert most of the engine across to it on Win32, and *then* do the port.

Richard "Superpig" Fine
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
ry. .ibu cy. .y''ybu. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
OpenGL is a language

Share this post


Link to post
Share on other sites
quote:
Original post by Stealth2000
You can play games on a Mac?!


Yeees... they''ve adopted OpenGL as their native 3D graphics API.

You can also run Maya or Softimage on one, too...

Share this post


Link to post
Share on other sites
"Too bad no serious computer user (musicians/artists excepted) cares. "

I hope you''re kidding...

To the original poster, check out iDevGames.com. It''s a site devoted to Mac game programming, and any questions you can''t get answered here, you can probably get answered there.

Share this post


Link to post
Share on other sites