Frederic,
Your patch helps, but typically the semantics of sleep() commands is they will sleep at least as long as the requested time (up to the kernel trap timing resolution) so I am still seeing dropped frames, although not nearly as bad. If the kernel timing resolution is different than the monitor refresh resolution with no convenient multiples (i.e. 60hz vs 100hz), it's always going to be imperfect.
Regards,
Curt.
Frederic Bouvier wrote:
Could you try this patch :
cvs -z4 -q diff -u main.cxx (in directory I:\FlightGear\cvs\FlightGear\src\Main\) Index: main.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Main/main.cxx,v retrieving revision 1.194 diff -u -r1.194 main.cxx --- main.cxx 9 Mar 2005 15:12:01 -0000 1.194 +++ main.cxx 9 Mar 2005 16:53:34 -0000 @@ -233,12 +233,11 @@
double throttle_hz = fgGetDouble("/sim/frame-rate-throttle-hz", 0.0); if ( throttle_hz > 0.0 && scenery_loaded ) { - static double remainder = 0.0; - // simple frame rate throttle - double dt = 1000000.0 / throttle_hz + remainder; + double dt = 1000000.0 / throttle_hz; int wait = dt / 1000; - remainder = dt - ( wait * 1000.0 ); + if ( wait > 0 ) + wait -= 1;
current_time_stamp.stamp(); int t_ms = (int) ( ( current_time_stamp - last_time_stamp ) / 1000 ) ; /* Convert to ms */ @@ -246,6 +245,9 @@ ulMilliSecondSleep ( wait - t_ms ) ; } current_time_stamp.stamp(); + while ( current_time_stamp - last_time_stamp < dt ) { + current_time_stamp.stamp(); + } } else { // run as fast as the app will go current_time_stamp.stamp();
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d
-- Curtis Olson http://www.flightgear.org/~curt HumanFIRST Program http://www.humanfirst.umn.edu/ FlightGear Project http://www.flightgear.org Unique text: 2f585eeea02e2c79d7b1d8c4963bae2d
_______________________________________________ Flightgear-devel mailing list [email protected] http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
