Quote:Original post by phresnel
Personally I am a big fan of fixed timesteps. Glenn Fiedler has a good article about that: Fix your timestep.
it's really a good article!
Quote:Original post by phresnel
Personally I am a big fan of fixed timesteps. Glenn Fiedler has a good article about that: Fix your timestep.
QueryPerformanceFrequency((_LARGE_INTEGER*)(&Sys_Freq));
... while( delta < Sys_Freq/MAX_FPS ) // maximize fps { QueryPerformanceCounter((_LARGE_INTEGER*)(&ticks)); delta = ticks - PrevTicks; } PrevTicks = ticks;...
Quote:Original post by szecs
Hi!
What do you experienced programmers think of that?
__int64 ticks, delta = 0; while( delta < Sys_Freq/MAX_FPS ) { QueryPerformanceCounter((_LARGE_INTEGER*)(&ticks)); delta = ticks - PrevTicks; } PrevTicks = ticks; Frame_Per_Sec = (double)Sys_Freq/delta;
double dt = 1.0/Frame_Per_Sec; Particles.vx += accel[0]*dt; Particles.vy += accel[1]*dt; Particles.vz += accel[2]*dt; Particles.x += Particles.vx*dt; Particles.y += Particles.vy*dt; Particles.z += Particles.vz*dt;
Quote:Original post by szecsWhy is timeGetTime used more in games than QueryPerformanceCounter?
Quote:Original post by szecs
I don't use sleep().
Quote:Original post by szecs
The while code is only used to limit the framerate, because my demo runs at nearly 3000 fps without it, and my videocard emits a strange noise, I don't know , maybe the cooler.
But it's clear for me now that it isn't a good method I'm using, but I don't really want to go deeper in the thing, I'm only a hobby "programmer". But thanks for the replies anyway.