whats needed for true platform independent?
Will a console application using GLUT and OpenGL in MSVC++6 be able to run, un-changed and not recompiled, on a different system than Windows? If not, than what is needed to do this?
Hmmm, your program must be recompiled for the different
platforms. You can''t avoid that.
My GLUT programs can compile with no modification
on Windows, Linux, and Solaris. And yes, they run identically
on all 3 platforms (appearance, not performance).
The only thing I need is this:
That and the sleep function. I use Sleep
for Windows and nanosleep for Linux/Solaris.
Kami no Itte ga ore ni zettai naru!
platforms. You can''t avoid that.
My GLUT programs can compile with no modification
on Windows, Linux, and Solaris. And yes, they run identically
on all 3 platforms (appearance, not performance).
The only thing I need is this:
#ifdef WIN32#include <windows.h>#endif#include <GL/gl.h>#include <GL/glut.h>
That and the sleep function. I use Sleep
for Windows and nanosleep for Linux/Solaris.
Kami no Itte ga ore ni zettai naru!
That''s tight, my game is so platform dependent it makes me sick Unless you consider the XBox another platform, then its portable lol
Mindgamez Entertainment
Mindgamez Entertainment
Either go to the other platform and compile it on a native compiler, or use a cross-compiler. I believe you can''t do this with MSVC.
I''d have tried to make a platform independent engine but I''m using DirectX so no dice lol
Mindgamez Entertainment
Mindgamez Entertainment
I recently discussed this actually, and one thing I didn''t think of is that you have to take endian-ness into account. Make sure that you convert to the right endian for the OS, otherwise your program will be garbage ( thinking about loading files from disk now ). There are functions to convert "network endian" into native OS endian though, which you will most likely need to use. I forget the names.
Death of one is a tragedy, death of a million is just a statistic.
Death of one is a tragedy, death of a million is just a statistic.
"How do you set your compiler for the multiple systems? Can it be done easily in MSVC"
no
Why would microsoft want to make a compiler that works for non-ms operating systems?
no
Why would microsoft want to make a compiler that works for non-ms operating systems?
quote:Original post by neurokaotix
That''s tight, my game is so platform dependent it makes me sick Unless you consider the XBox another platform, then its portable lol
Mindgamez Entertainment
wow... the last i heard they were just making theorys on how to make apps for the xbox! although that was about 3 months ago... -PmanC
My engine (Avangion) is platform-independant (Works on Windows and Unix based systems). The matter concerning little and big endian is annoying but can be resolved quite easily. First, find out what system your engine is compiled on by using #ifdef. Windows works with little endian while Linux works with big endian. Then, simply #define some macros that automatically convert the data if it is necessary. Here is some pseudo-code:
#ifdef LITTLE_ENDIAN
#define SWAP16LE(x) (x)
#define SWAP32LE(x) (x)
#define SWAP16BE(x) Swap16(x)
#define SWAP32BE(x) Swap32(x)
#endif
#ifdef BIG_ENDIAN
#define SWAP16LE(x) Swap16(x)
#define SWAP32LE(x) Swap32(x)
#define SWAP16BE(x) (x)
#define SWAP32BE(x) (x)
#endif
The Swap16 & Swap32 functions simply switch the high order byte(s) with the low order one(s) using bitwise ops.
Hope that helps!
#ifdef LITTLE_ENDIAN
#define SWAP16LE(x) (x)
#define SWAP32LE(x) (x)
#define SWAP16BE(x) Swap16(x)
#define SWAP32BE(x) Swap32(x)
#endif
#ifdef BIG_ENDIAN
#define SWAP16LE(x) Swap16(x)
#define SWAP32LE(x) Swap32(x)
#define SWAP16BE(x) (x)
#define SWAP32BE(x) (x)
#endif
The Swap16 & Swap32 functions simply switch the high order byte(s) with the low order one(s) using bitwise ops.
Hope that helps!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement