Cross platform programming

Started by
1 comment, last by markr 19 years ago
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.
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).
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

This topic is closed to new replies.

Advertisement