float GetFrameSpeed( void );

Return Value

Amount of time in seconds since beginning of drawing previous frame until beginning of drawing last (current) frame.


The GetFrameSpeed method is useful to retrieve information about how long took drawing of the previous frame. This information can be used for example to update position of moving (animated) objects or for another similar purposes. For example if you know that some object is moving at certain speed, you can update itís coordinates by aplying the time returned from GetFrameSpeed and speed vector to current objectís position.

The GetFrameSpeed method needs to be called between calling the COpenGL::DrawBegin and COpenGL::DrawEnd methods. Propsed use is this:

1. Call DrawBegin method
1. Call GetFrameSpeed method
1. Use retrieved frame speed time to update animated objects (positions, rotations, textures etc)
1. Draw the scene and animated objects
1. Call DrawEnd method

See Also

StartAnimation, StopAnimation, IsAnimationStarted, SMovementInfo structure, DrawBegin