[visionegg] Re: poll LPT during swap_buffers()
- From: Andrew Straw <andrew.straw@xxxxxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Thu, 10 Jul 2003 13:07:49 +0200
Christoph Lehmann wrote:
Since in the swap_buffers() code you wait for the vsync pulse: would it
be possible not only to wait for the vsync but in this time also
polling
the LPT, logging any changes in the Lpt and returing it to the main
loop
(with a log-object as return value)...? would be nice, this way being
able to log button-box responses, wired to LPT, even during the small
time-window, where VE waits for the vsync.
Hi Christoph,
One of the most annoying things about modern video systems is that
there is no easy way to do what you want.
When the swap_buffers() function is synchronized to the vertical
retrace, it blocks--doesn't return--until the monitor is sent a
vertical sync pulse. It would be great to have a callback function or
event notification system, but such a thing does not exist on the most
common operating systems. (However, I think we may get this with
OpenGL 2.0.)
I can name several (more difficult?) ways to do what you want. In
order of increasing complexity:
1) Don't operate with swap_buffers() synchronized to the vertical
retrace. (It might be necessary, depending on your stimulus, to guess
how many frames you've drawn based on your display's refresh rate.)
2) Write a threaded application that calls swap_buffers() in one
thread, but listens on LPT in another thread.
3) I've heard about some Windows-only function which lets you ask the
video card what line it's currently drawing, and therefore you could be
smarter about time-management within your program, calling
swap_buffers() only at the last possible moment.
4) Use a data acquisition device (instead of the LPT port) which is
configured to time-stamp the arrival of the pulse.
Cheers!
Andrew
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
Other related posts: