Interrupting long draw cycles
Reuel Nash
reuel at khaki.asd.sgi.com
Wed Mar 13 04:18:32 AEST 1991
In article <9103112256.AA08202 at karron.med.nyu.edu>, Dan Karron at UCBVAX.BERKELEY.EDU writes:
> I want
> to interrupt the drawing program with a signal, say SIGUSR1. The signal
> handler will then do a longjmp back to the main drawing loop with
> new eye position and viewing values and start drawing.
>
> This will entail the gl calls being interrupted and aborted at any step.
>
Don't do it this way. Commands and data written by the gl must
be complete or you can take the graphics system down.
> Is there a gracefull way to interrupt the gl subsystem to regain
> control ? Can I stop a long draw cycle and start another without
> dammage to the gl pipeline ?
>
The appropriate thing to do is to have your signal handler
set a flag that is checked syncronously by your main drawing
loop. This can (and should) be at a higher level than every line
or polygon. If data is organized as objects, check after drawing
each object. If data is not organized as objects, check after
drawing every N objects, where N is set by your desired response
time and drawing rate. The flag should be declared 'volatile'
or the optimizer will think it can't change inside the loop
and may optimize it away.
>
> Dan.
Reuel Nash Email: reuel at sgi.sgi.com
"Question Skepticism" Voicemail: (415)962-3254
Mail stop:SR-254 Work Phone:(713)266-1333 Home Phone:(713)589-6258
USMail: Silicon Graphics, 5858 Westheimer Suite 100, Houston, TX 77057
More information about the Comp.sys.sgi
mailing list