Re: [info-performer] How to calculate change in Frame time.

Date view Thread view Subject view Author view

From: Benedikt Kessler (bjk++at++sgi.com)
Date: 02/03/2006 05:16:32


Hi,

Harri.Mahonen++at++seamk.fi wrote:
>
> Hi,
>
> > Is there any library utility for calculating change in Frame time
> > (deltaFrameTime).
>
> Simple way is to use pfGetTime. You need three variables: current time, last time and delta. Set all to zero.

>
> 1. At the beginning of the frame, get the current time with pfGetTime.
Or get the "official" pfGetFrameTimeStamp(); thus you don't have to make sure you grab the pfGetTime at the beginning of the frame.

> 2. Calculate delta by (current time - last time) / 1000.0
This should be 1.0/pfGetFrameRate(). If your using a phase mode FLOAT or LOCK the APP process should run at the framerate independent of the rate of the DRAW process (unless the APP process has overruns).

> 3. Use the delta how you see fit.
> 4. At the end of the frame assign the current time you got at step 1 to last time.
> 5. Repeat.
>
> This is what I use and it works. The very first frame's delta time is 0, but that isn't an issue (for my purposes, at least).

There is also pfGetFrameTimeFlux (this is from the pfFrame manpage):

        pfGetFrameTimeFlux returns the global frame time flux. The frame time flux
        is a pfFlux that is updated with the frame time stamp of the current frame
        whenever it changes. By default the frame time flux is configured with the
        PFFLUX_PUSH mode set to PF_ON. The frame time flux is useful for
        automatically driving pfEngine animations.

Bye! Benedikt

-- 
+---------------------------------+----------------------------------+
|Benedikt J. Kessler              | Silicon Graphics GmbH            |
|Advanced Media Products          | Am Hochacker 3 - Technopark      |
|SGI                              | 85630 Grasbrunn-Neukeferloh, FRG |
|    ---  __o       ,__o          |                                  |
| ------_ \<,_    _-\_<,          | Phone: (+49) 89 46108-366 or -0  |
|----- (*)/ (*)  (*)/'(*)         | Fax:   (+49) 89 46107-366        |
+---------------------------------+----------------------------------+
|E-Mail: bjk++at++sgi.com            Web (private): http://sgiweb.org/bjk |
|   Web: http://www.sgi.de                                           |
+--------------------------------------------------------------------+


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Feb 03 2006 - 05:17:05 PST