Subject: Some thoughts on shutter-glasses

From: Bernie Roehl <[email-masked]>
Date: Thu, 24 Oct 91 8:37:46 EDT

When interfacing to shutter-glasses, we ideally want to be able to switch
eyes every 1/60th of a second.

That means we want to do it on every vertical retrace; it would be really
nice if the VGA card were to generate an interrupt on vertical retrace,
but it doesn't.  That leaves only two approaches:

	- polling
	- using the timer interrupt

The problem with polling is that you have to pepper your high-level code
with calls to a routine that checks for vertical retrace and switches the
screens and the LCD glasses.  That's not too bad, though, since the routine
is very simple and very fast.  If you miss one swap, it's not the end of
the world.

The interrupt approach is good, but assumes that you can program the timer
to run at *exactly* the framing rate; even a small inaccuracy will cause you
to "drift" and miss the retrace.

Alternatively, you could reprogram the timer on each vertical retrace, and
thereby eliminate the inaccuracy.

Bear in mind that if you're supporting both the glasses and the glove, you
now have a few things to do on timer interrupts; this may be the way to
go, but requires some more thought.  (At least, *I* require some more thought).

(A first pass:)

The glove gets polled every 4 ms, the display gets swapped every 16 ms; so...

timer interrupt routine runs every 4 ms, and does the following:
	- increment a counter
	- if the counter reaches 4:
		- wait for a vertical retrace
		- reprogram the timer
		- swap the display
		- zero the counter
	- in any case, do the glove stuff

Now, waiting for a vertical retrace is a bad idea if we just missed one;
we'll miss glove events, for one thing.  However, this shouldn't happen
after the first time through.

Reprogramming the timer may be more serious; will we wind up with major
inaccuracies?  Will the system time-of-day clock drift?

Any feedback would be appreciated...

-- 
	Bernie Roehl, University of Waterloo Electrical Engineering Dept
	Mail: [email-masked] OR [email-masked]
	BangPath: watmath!sunee!broehl
	Voice:  (519) 885-1211 x 2607 [work]

---

From: [email-masked] (Adrian Godwin)
Date: Thu, 24 Oct 91 18:22:35 +0100

> is very simple and very fast.  If you miss one swap, it's not the end of

This is ridiculous : you're solving the wrong problem, and it's costing you
a fortune in CPU resource to do it. If you need to do something on a vertical
retrace, (and if you can't get out of it by using interlace, say) then 
GENERATE THE INTERRUPT ! You need some hardware to drive the LCD shutter :
drive that hardware from the VSYNC signal and also feed it into an interrupt
input. There are lots of ways you can generate the interrupt - straight onto
the bus, a serial port status line change, the parallel port ACK input, a 
countertimer input .. just choose one !

-adrian