Hi GL folks.
I’m using glutTimerFunc() to animate the characters in my game.
A friend of mine suggested that I should call glutTimerFunc() before any other code in my Func. However, I was doing the opposite. He even show me that without calling glutTimerFunc() first my drawing rate will differ from one PC to another.
Func(int v){
// First
glutTimerFunc(32, Func, 0);
// My code
}
Func(int v){
// My code
// Last
glutTimerFunc(32, Func, 0);
}
I investigated this subject my trying this:
Func(int v){
int r = rand() % 10;
printf("start
");
//glutTimerFunc(32, myTimer, 0); // Case #1
sleep®; // in sec
//glutTimerFunc(32, myTimer, 0); // Case #2
printf("end
");
}
In both cases, it always kept running Func() until it finishes before calling it once again.
So the pattern was:
start
end
start
end
start
end
…
…
Any opinions, which is correct or both of them???