On Thu, Jun 25, 2009 at 5:55 PM, Gachuk <[email protected]> wrote:

>
> Hi,
>
> I've been having a strange timing problem, with the following code I
> expect to get around 16ms as the deltatime instead I get around 30ms,
> this is not just variance it is consistantly 30ms, which would imply
> it's not updating at the correct speed.
>
> ###
> import pyglet
>
> # App Entry point
> def main():
>    def update(dt):
>        print dt
>
>    pyglet.clock.schedule_interval(update, 1/60.)
>    pyglet.app.run()
>
> if __name__ == "__main__":
>    main()
>
> ###
>
> I am running this on the latest source from the trunk (although i also
> tried 1.1.3) a QuadCore Intel 64bit windows 7 build, but I have
> experienced the problem on other machines. However a friend on a mac
> ran it and said he did get 16ms and I've had others on windows XP also
> tell me it's running at 16ms
>
> What is interesting is that if I start certain other applications, the
> timing gets more accurate. Someone suggested to me it might be to do
> with the applications I start using timeBeginPeriod/timeEndPeriod
> which could apparently effect globally. See
> http://www.virtualdub.org/blog/pivot/entry.php?id=106
> for more info on that.
>
> I have noticed that the trunk version uses time.clock() now instead of
> time.time() although it makes no difference eitherway.
>
> I would appreciate any ideas about this.
>
> Thanks in advance
>
> Gachuk


Unless you have a definite need to fix your frame rate at 60 fps, I would
suggest you use schedule() rather than schedule_interval, and let the vsync
limit your frame rate to the actual monitor refresh rate.

As for the variable delta, scheduling tends to be more of an 'at least 16
ms' than an 'exactly 16 ms', since you are at the mercy of the OS scheduler.

-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to