That's one of those typical I/O problems where I'd go and spawn a
thread in which I'd call a C function which operates a while loop at
1khz and sleeps inbetween, then pushes its results to an output queue.

On Jan 19, 4:52 am, Prantik <[email protected]> wrote:
> Hi there,
>
> I have some external experimental hardware providing data to my pyglet
> app in real-time (device access with ctypes), and it'd like to poll it
> for data at 1000Hz. Currently, my implementation is with a while loop
> in __main__ and manual ticks and flips, which works great, but of
> course thrashes CPU. I just need it to run at 1KHz, but my while loop
> runs at 600KHz, with each iteration checking my hardware for new data.
> I'm managing my ticks and framerate with time.time() to get a very
> nice constant 30.00 fps from the HUD meter.
>
> To try to get this speed and CPU util down to something between 1 &
> 10KHz, I've tried implementing this with the standard schedule and
> app.run() framework, but my problem is that schedule_interval has
> resolution only as good as my framerate, which is 60Hz max with vsync
> on and 500Hz with it off (i.e. fullscreen fps) along with unsightly
> shearing.
>
> I've thought about using the EventLoop class and overriding the idle()
> function, as that seems like it would let me evaluate code at much
> higher rates than framerate with vsync on (but less than while), and
> tick and flip when I need to (e.g. to get 30 fps), but a) you
> suggested that I not, being a n00b, and b) I don't know where to
> start, nor do I have any examples..
>
> Please help.
>
> Thanks,
> Prantik

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