[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Of time scaling and FPS
- To: linuxgames@sunsite.dk
- Subject: Of time scaling and FPS
- From: "Miguel A. Osorio" <maos@gbl.com.br>
- Date: Thu, 09 May 2002 01:26:47 -0300
- Delivered-To: archiver@seul.org
- Delivered-To: mailing list linuxgames@sunsite.dk
- Delivery-Date: Thu, 09 May 2002 00:28:01 -0400
- Mailing-List: contact linuxgames-help@sunsite.dk; run by ezmlm
- References: <20020428125612.990A71036@gate.home.lan>
- Reply-To: linuxgames@sunsite.dk
- Sender: hornet@seul.org
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.