Aah, thanks Alex. The invalid flag will be helpful!
On Aug 28, 12:11 am, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 28, 2008 at 1:29 PM, Zachrahan <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the idea Laurens!
>
> > Unfortunately, if you take a look at pyglet.app.EventLoop.idle, you'll
> > see that on_draw gets dispatched for all windows each time the idle
> > loop runs. And with a bit more digging, you'll find that the idle loop
> > runs after every "wakeup" -- either from a GUI event, or after the
> > minimum scheduled interval.
>
> > Thus, while "UpdateMyGUI" only gets called at 10 Hz, every window is
> > repainted at 30 Hz -- in this case, a 3x waste, since the contents of
> > the window only change at the slower rate...
>
> > The simple solution is to subclass the idle loop to not always call
> > on_draw, but then the window class needs to take care of doing that
> > itself. Not a problem, but it makes it harder to use 3rd-party pyglet
> > window classes. Better, perhaps, would be to have the custom idle loop
> > decide when to call on_draw based on whether a GUI event happened or
> > not.
>
> You can probably avoid subclassing EventLoop by taking control of the
> Window.invalid flag yourself. Set this to False at the end of your
> on_draw handler, and to True in your scheduled function. The default
> EventLoop only calls on_draw if Window.invalid is True.
>
> Alex.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---