Hi again Leif,

Thank you for your answer.

I avoided using "window.on_draw" because I did not understand it completely
and I wanted to maintain the "window" instance as a local variable inside
the "main()" function.

Can I maintain the "window" instance being a local variable in main() and
use the "on_draw" function?

Thanks

On 11 February 2015 at 16:34, Leif Theden <[email protected]> wrote:

> Thanks for sharing that.  I've looked over it, and my initial comment
> still stands.  In the github repo, around lines 180 - 225, you are doing
> all of your updating and drawing in the same block of code, all of which is
> at the mercy of the pyglet clock.
>
> The pyglet clock, and all software timers are inaccurate, no matter if it
> is python, or C, and you need to decouple your updates from your drawing.
> My recommendation is to move all the drawing functions to a callback from
> window.on_draw.  For your updating code, you can build a function with that
> and schedule it using the clock.
>
> After that you should use pyglet.app.run().  The pyglet app has some
> platform-dependent code that may help smooth out your framerate by allowing
> the program to sleep, too.  Please see the following code from the pyglet
> docs to see how to get code called from window.on_draw:
>
> http://www.pyglet.org/doc/programming_guide/image_viewer.html
>
> This type of event oriented programming is a common way to get smooth
> framerates.  Hope that helps.
>
> On Wednesday, December 10, 2014 at 8:58:14 AM UTC-6, Jose Luis Da wrote:
>>
>> Hi all,
>>
>> I have been working with pyglet in order to create a series of OpenGL
>> figures and animate them given some parameters.
>> I have obtained what I want, but the movements of these figures is not
>> smooth all the time, the movement is sometimes glitchy.
>>
>> What are the most common sources of this kind of errors? Could you tell
>> me if there is something I am doing wrong in the code?
>>
>> You can find the code here: https://github.com/thisisjl/NuEyePlaid
>>
>>
>> Thank you,
>> jl
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "pyglet-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pyglet-users/JgEtp7YL8SQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pyglet-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to