Porting code from Pc to Mac

Hi, Im learning 3d gameprogramming on the pc, but ive been thinkin

bout getting a mac ( they are a lot more reliable ).

the problem is how I port the code to the mac.

The book ( cutting edge 3d game programming with c++ )

says that "some readers" have suceeded in doing so in

a matter of hours. Im pretty new to c++, and I havent got a clue

where to get help or start if im gonna port my code.

I will at least finish the book BEFORE I buy my macintosh.

It would be nothing but stupid to change now.


hope for an answer


//durandal


Comments

  • : the problem is how I port the code to the mac.

    : The book ( cutting edge 3d game programming with c++ )

    : says that "some readers" have suceeded in doing so in

    : a matter of hours.


    It's not totally trivial if you're not using ANSI C or C++, which, if you're doing graphical work, is true. I've done this sort of thing before for small modules.


    It comes down to how modularized the code you want to port is. For example, if all of the mathematical components in your 3d book are isolated, then they'll work just as well under a Mac compiler as a PC one. Then, all you have to translate is the graphical routines themselves.


    On the other hand, if they've been thoughtless enough to mingle machine-specific GUI stuff with the mathematical model, then your job will be more difficult (because you'll have to weed through a lot more code).


    In any event, the part that you will have the most work with, or even be forced to rewrite, will be the bits that interact directly with the operating system. For example, you will have a different initialization procedure to get the operating system set up. You'll have a different event handling loop to deal with menus and mouse clicks. This will be the tough part.


    The other tough bit will be finding analogs to the hardware or operating system specific things that are done. A DOS graphics mode switch will have to be removed, and a window brought up in the Mac universe instead. Direct-video manipulation won't work the same way because of hardware differences. A Windows line drawing routine will have to be converted to a Mac line drawing routine.


    Personally, I like the Mac's API better, myself. It's less kludgey in a lot of ways. But it won't necessarily be a really simple port.


    Of course, I should mention that it might be in fact quite easy if the operating system and hardware specific stuff is isolated and relatively small.


    I don't know if this helps, but there's certainly no hard and fast rules.


  • ok, i mean i will probably not even port the code

    though I am gonna write one on my own when

    ive finished reading the book. but thanks for

    the help.


    //durandal


  • : ok, i mean i will probably not even port the code

    : though I am gonna write one on my own when

    : ive finished reading the book. but thanks for

    : the help.


    : //durandal


    I didn't mean to give you the impression that it was an impossible task... But I wish you the best of fortune writing your own. It'll probably be a hoot.





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories