Hi Matthias, Thank you very much for the explanation. I've got a much better understanding.
I have another question. Now I will try to implement my own event loop based on SDL ticks functions. Can I use Fl::check() in my loop so that all FLTK windows will be updated periodically? Thanks, Chang > > On 22.02.2009, at 02:03, Chang Yuan wrote: > > > I'm using Fl (v1.3) timeout functions to get accurate frame rate > > control under Windows. I followed the documentation to use > > Fl::add_timeout and Fl::repeat_timeout with the same time interval, > > e.g. 30 milliseconds. However, the callback function is not executed > > at the expected intervals. I used QueryPerformanceCount to get the > > execution time and found that FLTK's timeout function is always > > behind my expected intervals, say around 35 msecs to 40 msecs. Even > > if I decrease the time interval to an insane value, FLTK can only > > reach up to ~40fps. Is this a bug or the limitation of the current > > version (v1.3)? Will v2.0 do better on this? > > > First of all, MS Windows is by no means a real time operating system. > Any timing efforts in the millisecond range a futile. Even in the > range of seconds, I would not expect MS Windows to schedule a proscess > for me. Other appilcations may steal all available time, and the OS > has no provision to keep them from doing that. The same is true for > Linux and OS X. > > The FLTK timeout functions rely on the internal timers of the OS. The > MS Windows timers depend on a few hardware factors, but usually have a > resolution between 10 and 40ms (hence the 40 fps you are seeing). But > even then, there is no guarantee that your application will actually > receive on of these slots. "QueryPerformanceCount" on the other hand > *is* very high precission, but that is merely a counter, not a timer. > > This would all be a desaster for multimedia and video applications. MS > Windows has creates a huge bunch of libraries and implemented tons of > extra hadware to get around those basic limitations. Linux uses a > slightly different approach, and OS X is somewhere in the middle of > all this. > > So if you are planning to play a video in FLTK< you would have to fall > back to one of those native video libraries and use their timing and > rendering functions. > > Matthias > > ---- > http://robowerk.com/ > > _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
