|
From: JS <jsc...@gm...> - 2001-09-28 12:17:45
|
Well you may use the timeticks as described in an email before - but you will have to integrate several ticks in order to get a clear value : I would reset a frames counter to zero and save the number of ticks into startticks then wait at least 100 frames - and read the ticks counter and store a new starttickvalue FPS =3D 100 *1000 * 10 / (newtickvalue - starttickvalue) 100 frames * 1000 millis * 10 accuracy factor why do i explain this easy math ? - well 100 frames should be used for precision / accuracy : windows reports not the real ticks - but a difference of some milliseoncs. taking only the ticks between one frame would lead to inacurate values. 100 is a good choice / compromise bettween accurr. and speed. if your app leads to nuch less then 100 frames per second - the value might be reduced - try to obtain at least around 1000 ticks after having calculate a new actual FPS value , perform a smoothing : average =3D average - (average >> 2) + (newvalue >> 2) where 2 or more (up to eg 5) increases smoothing after this oldvalue =3D oldvalue - (oldvalue >> 2) + (newvalue >> 2) value 2 above is dynamic hysteresis and avoids toggling (might be up to 4, where larger means quicker !!!) if ((average > (oldvalue + 4) or (average < (oldvalue - 4) )-> oldvalue =3D average; screenupdate using average / 10; value 2 above is static hysteresis and avoids toggling (might be up to 4, where smaller means quicker) remember : value avarage / 10 ist the real FPS -> see accuracy factor j=FCrgen On 25 Sep 2001, at 23:00, Stein Nyg=E5rd wrote: > Hi all... > > I's been a while, cause I've been busy setting up my new Athlon 1400mhz. > It's working great, so now I'm ready to move on with the OpenGL! > So, I just can't figure out how to make a good, fast and precise > FramesPerSecond-Counter. Any suggestions? > Thanks! > > Stein > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |