[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Of time scaling and FPS



Hey people,



	I have some matters about time scaling and a little FPS problem I'm
having on my project to discuss. About time scaling, just to make sure,
the correct way to calculate one frame time could be:

// Main loop - no time scaling
while(true)
{
	get_input()
	update_states_and_variables()
	render()
}

	The calculation I'm talking about would be something like:

// Main loop
while(true)
{
	tf = gettime()
	delta = tf - ti
	ti = gettime()

	get_input()
	update_states_and_variables() // Use delta here on time dependent
variables
	render()
}

	Is this one right way to do it?

	Anyway, on to the FPS problem. Using the method described above, I use
delta to scale my time-dependent variables, in order to get some smooth
animation. Thing is, I don't. The whole animation looks all jagged up,
without using time scaling it goes on fine; do note that, however, I
don't know why, the FPS mark keeps jumping about *all the time*, it
never settles on some average. Does anyone know a reason for this? Or am
I doing the whole time scaling calculation the wrong way?



Many thanks,
Miguel A. Osorio.