Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!ubc-cs!alberta!news From: steve@obed.uucp (stephen Samuel) Newsgroups: comp.sys.sgi Subject: Re: TIMERn devices - what are they? Summary: They work like this.... Keywords: timer, device Message-ID: <1989Aug13.155425.16745@alberta.uucp> Date: 13 Aug 89 15:54:25 GMT References: <10976@watcgl.waterloo.edu> Sender: news@alberta.uucp (News Administrator) Distribution: comp Organization: University of Alberta, Edmonton, Alberta, Canada Lines: 48 From article <10976@watcgl.waterloo.edu>, by fjhenigman@watcgl.waterloo.edu (Frank J. Henigman): > Can anyone explain what the devices TIMERn (where n = 0, 1, 2, 3) are > in the device.h file? Can they be used for anything? Thanks. The timer devices generate one event every 1/60 sec. More specificly, they seem to generate one per vertical sync. They can be used for various things. We, for example, have a Tektronix stereo LCD shutter. To use it, we start up a timer, and for each timer event, we do a swapbuffers (first, of course, we have to draw the two stereo pictures...). roughly (from memory): In this case, we need one event per 1/60 sec, so I use `noise(1)`. If you needed only needed 5 events per second then you could use `noise(12)`. ------------------------ Cut here and add water ------------------------- #include "everything.necessary" draw(leftimage); swapbuffer(); draw(rightimage); swapbuffer(); qdevice(TIMER0); noise(TIMER0,1); /* **** VERY IMPORTANT -- you need to do this before * you get timer events --- THIS IS UNDOCUMENTED (grr!) */ /* the following will wait for an odd-numbered timer event... This is *an attempt to make sync left and right sides with what the shutter *thinks are the appropriate side. */ while(qread(&val)!= TIMER0 || (val&1)!= 1 ); while( happy){ device=qread(&val); switch(device){ case TIMER0: swapbuffer(); break; . . . . case blegh: happy=0; break; }; /* EOF */ -- Stephen samuel !alberta!{obed,edm}!steve "Look on the bright side... It might have worked!"