On Oct 9, 8:53 pm, sticksen <[email protected]> wrote:
> On 9 Okt., 15:24, Ben Sizer <[email protected]> wrote:
> Hi Ben,
>
> thanks for your reply! Is there some variable I could check to
> determine if vsync is really on/off?

I've no idea, I'm afraid. No doubt that would come down to another
extension somewhere, unless pyglet exposes it somehow.

> > Isn't play_frame supposed to take a dt parameter? Providing pyglet is
> > populating that value accurately, if you factor that into the movement
> > distance calculation then you may get smoother animation.
>
> Of course, play_frame() also gets a dt value. How would you use this
> for a smoother movement distance calculation? Is there maybe some kind
> of pseudo code somewhere?

Smooth movement requires an unchanging velocity, even if frames are
not rendered at exactly equal intervals. So just decide how many
pixels per second you want to move (eg. 400), and instead of using the
constant 10, use (pixels_per_second * dt). For the smoothest motion,
store the accumulated value as a float but pass a rounded version to
blit().

> > 10 pixels at
> > a time will never look smooth, more so if the time taken to move 10
> > pixels varies slightly from one occurrence to the next.
>
> Well, I tried 1 pixel at a time, but it takes forever to move the pic,
> even with unlimited fps...

It would be interesting to know how many fps you actually get when you
turn the fps limiting off. Most modern platforms should be able to
give you 60-85 with vsync on for a simple scene, and at that frequency
you wouldn't need such a high number as 10 pixels each frame. Perhaps
there is inefficiency elsewhere in your application that is making
frames take a long time.

--
Ben Sizer

--~--~---------~--~----~------------~-------~--~----~
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