Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!sgi!reuel@khaki.asd.sgi.com From: reuel@khaki.asd.sgi.com (Reuel Nash) Newsgroups: comp.sys.sgi Subject: Re: Interrupting long draw cycles Summary: Don't interrupt gl! Message-ID: <90500@sgi.sgi.com> Date: 12 Mar 91 18:18:32 GMT References: <9103112256.AA08202@karron.med.nyu.edu> Sender: guest@sgi.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 33 In article <9103112256.AA08202@karron.med.nyu.edu>, Dan Karron@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@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