Hi there,
Currently I’m trying to create Grimind builds for Linux and Mac and it’s nightmare.
LINUX
Basically, I moved my code form Visual C++ to Eclipse under Linux and most of my code worked correctly right away. It’s because I used cross platform libraries like: GLFW, SDL, SDL_mixer, OpenGL – that’s cool. But when I run Grimind for first time it looked ridiculous. Particles were spawning only at one place and there was many graphical glitches. This is why it happened:
- On windows I used to use abs(…) function for float numbers and it worked correctly so abs(-1.2f) was changed into 1.2f so it worked for floats. On Linux there is no abs function for floats, so the same code on Linux produced bad return value. In this case -1.2f was converted first into integer value -1 and then the return value was 1 not 1.2f. The solution to that problem was to replace all abs functions to fabs
- I was mixing two values RAND_MAX and 32767 which on windows these was the same. On Linux RAND_MAX is 2147483647 so it is much larger number than 32767. In addition I was dividing random number from range 0..32767 by RAND_MAX. On windows this was correct and division result was from 0 to 1 that’s OK but on Linux this range was from 0 to 0.00001525832 not 1 and that’s why particles was spawning just in small area
I was able to create 32 bit build and it’s working but I still can’t make 64 bit to work correctly everywhere (it’s working for me)
MAC
I used xcode 4.6 to create build and it’s working fine but I cant set deployment target to 10.6 (Snow Leopard) because I use c++11 features in my code. That could mean that I will be able to create Grimind Mac build only for 10.7 and later (Lion and Mountain Lion) but I will look at this once again.