On a related note, I recently put together a simple pyglet script  
which displays buffered frames from a webcam. I scheduled an update  
function that got the next frame, and blitted it to the window. This  
was scheduled every 1/30 seconds. The script used 80+% of CPU time and  
the fps display said it was trying to draw at 60fps. Using  
clock.set_fps_limit did nothing to limit the frame rate.

However, by overriding the default EventLoop.idle to stop it from  
flipping the window every time idle() was called, and by explicitly  
flipping it within the scheduled update function the CPU usage  
decreased to ~30% and the playback was then perfectly smooth. This was  
the only way I could actually get an fps of 30, which was all that was  
needed as the cam only updates at 30fps.

Questions:
        1) Why does pyglet draw at 60fps, regardless of whether I use  
clock.set_fps_limit() ?
        2) Why does pyglet flip() the window buffers when _any_ event happens  
by default, even when that event doesn't alter the buffers? This  
behavior means that scheduling any function to be called at short  
intervals will push the fps to the maximum of 60, regardless of what  
that function is doing, i.e. whether it has an effect on the buffers  
or not. Not a criticism, just curious...

System was a windows XP machine with pyglet 1.1.2 on python 2.5.

-Padraig

On 26 Apr 2009, at 18:54, Tristam MacDonald wrote:

> I am trying to render at a (relatively) fixed frame-rate, using the  
> standard app-loop and a scheduled update function ever 1/30.0 seconds.
>
> However, I am also tracking mouse motion for the user interaction,  
> and it seems that every time a mouse event occurs, pyglet attempts  
> to redraw the screen. Is there any way to disable this behaviour? It  
> ends up pushing my frame rate too high, which results in a very  
> choppy experience.
>
> -- 
> 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