PDA

View Full Version : portability issue!



new23D
04-14-2003, 01:24 PM
i have just realised that using GLUT to handle windows would be simpler and also would make the program portable but i have used the MFC application in VC++ and used WGL to handle my window inputs but this makes the program not portable to other platforms. Is there any way to get around this?
Thanks!

nexusone
04-14-2003, 01:55 PM
Recode the windows part in glut or something like SDL.

Also you can break down your program into diffrent parts.

main.cpp // main functions
ogl.cpp // common openGL/graphics routines, non-OS type calls.
win.cpp // windowing functions, then create a win.cpp for each OS.
sound.cpp // sound call's, also make one for each OS
example:

My_openWindow(bla, bla)
{
// define how to open a window
// rewrite this routine for each OS you wish to port to.
/
}


Originally posted by new23D:
i have just realised that using GLUT to handle windows would be simpler and also would make the program portable but i have used the MFC application in VC++ and used WGL to handle my window inputs but this makes the program not portable to other platforms. Is there any way to get around this?
Thanks!

new23D
04-14-2003, 07:13 PM
That's great!but i'll have to learn how to code to port to other OS http://www.opengl.org/discussion_boards/ubb/biggrin.gif.I'll see if i can make it.
Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

deadalive
04-15-2003, 03:13 PM
I REALLY recommend SDL, it's so simple (thats what the "S" stands for!) and it makes porting alot easier. Also think about the GCC compiler because it has the best cross-compiler I know of.

I write programs in SDL and it's like nothing to port it from windows->linux or vice versa.. the code is basically the same! Try it, you'll like it

marcus256
04-16-2003, 09:53 PM
...or GLFW (http://hem.passagen.se/opengl/glfw) . IMO it's even more portable than SDL. It doesn't have sound, but there are many portable sound libraries that are much, much better (and portable) than SDL's sound.

It's easy to write a GLFW-based program that does not need a single change to the source code to compile it on different platforms (of course the Makefile will need some changes, but that's unavoidable and trivial in any case).

I also strongly suggest that you separate your code into different parts. Don't forget architecture differences too (assembler, endianity, 32 vs 64 bit longs etc). If you do things right (which is not that hard), you'll be able to compile your program on almost any computer in the universe (at least with minimal efforts).

I always get a kick when people report back to me and say things like "I successfully ran your program on an SGI/IBM/HP/QNX/..." http://www.opengl.org/discussion_boards/ubb/wink.gif