On Mon, Jul 23, 2012 at 9:11 PM, Tristam MacDonald <[email protected]> wrote: > On Mon, Jul 23, 2012 at 1:49 PM, anatoly techtonik <[email protected]> > wrote: >> >> On Mon, Jul 23, 2012 at 8:31 PM, Tristam MacDonald <[email protected]> >> wrote: >> > On Mon, Jul 23, 2012 at 6:46 AM, anatoly techtonik <[email protected]> >> > wrote: >> >> >> >> Hi, >> >> >> >> What is the correct way to initiate window redraw? >> > >> > >> > What's wrong with scheduling an update function? IIRC, that should >> > trigger a >> > redraw whenever it occurs. >> > >> > def update(dt): >> > pass >> > >> > pyglet.clock.schedule_interval(update, 1/60.0) >> >> Thanks. Surprisingly, an empty update() call kicks event loop as >> expected. I want to measure maximum FPS possible on 100% CPU load, so >> a 1/10000 value looks good for my case. But for the clarity I'd still >> prefer to kick event loop explicitly. Unfortunately, Google Code >> Hosting is down at the moment and don't allow me to browse the sources >> to see how is it implemented. >> -- >> anatoly t. > > > Ok, so it's not really possible to do so unless you implement your own event > loop. > > The default event loop redraws every window for which window.invalid == True > (which it is by default), every time through the event loop. > > If you want to redraw as fast as possible, you do exactly as you did > (schedule a high frequency update function), because each time that is > called the event loop is run, and redraw will happen.
I'm looking at the pyglet.clock code from pyglet.clock.schedule_intervalpyglet.clock.schedule_interval entrypoint and can't find a place where an event loop iteration is triggered. There is a Clock.call_scheduled_functions, but it is still unclear what causes it to run, how does it interacts with the event loop and how come that the on_draw() is called as a result? http://code.google.com/p/pyglet/source/browse/pyglet/clock.py -- anatoly t. -- 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.
