• Advertisement
Sign in to follow this  

Cross platform programming

This topic is 4776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Apologies for my n00bishness once again... I just fixed my old PC to be dualboot Win2K and FC3. I'm not really at the right stage yet, but planning ahead I was wondering about writing programs that'll run on both platforms in C++. What changes need to be made in OpenGL/SDL written to run on Linux to make it run on Windows (and vice versa)?. Because I've heard that OpenGL uses a lot on Win32. I know that basic C++ console programs will work on both as long as you don't try to include Windows header files on Linux.

Share this post


Link to post
Share on other sites
Advertisement
OpenGl doesn't need any Win32 functions. SDL has everything you need.
With minimal modifications, an SDL/OpenGL program will run on both Windows and Linux (and even OSX, as long as you write the code to be endian independent).

Share this post


Link to post
Share on other sites
OpenGL itself isn't any different - it's more dependent on the drivers.

The only things that are significantly different are the context setup stuff - different modes may be available also depending on system settings.

Just write your startup code reasonably defensively and you should get away with most things.

Oh, and using glx / wgl functions directly is of course going to render your code nonportable to the other (although they are mostly approximately equivalent) - so stay away if you can.

Mark

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement