Re: [gtkmm] Re: How to do call a function once every 'frame'? And some documentation feedback.



Hi Bassoukos,

Bassoukos Tassos wrote:

On Sat, 2002-11-09 at 17:20, Dirk Gerrits wrote:


>But if I understand correctly, with Glib::signal_timeout() the whole
>DoFrame function becomes unnecessary:
>
>Glib::signal_timeout().connect(SigC::slot(&DoComputation), ms_per_tick);
>
>That's just plain cool! :) Thanks.
>
>Dirk


Hello Dirk,
unfortunately that is not the case! Gtkmm (and most non-Hard-RT
operating systems) only guarantee that the time interval is *at least*
as much as what you specified, never less (e.g. your slot will never be called earlier, but possibly later).

I do think think this gaurantee should be in the reference docs.

That means that you will need to both calculate how much time has passed since the last call and to calculate the remaining time after your computation has finished[1].

HTH,
Tassos
[1] consider: your computation takes 10 ms, and then you wait for
    another 20: sum total 33 ms or 30 frames per second, much less than
    20ms or 50 frames per second.

Hmm, I see. Well than I guess I can recycle some of that DoFrame pseudo code. ;) Too bad the one liner doesn't work, but I do understand why this would be necessary.

Thanks again,

Dirk




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]