Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!sgi!karsh@trifolium.esd.sgi.com From: karsh@trifolium.esd.sgi.com (Bruce Karsh) Newsgroups: comp.sys.sgi Subject: Fun GL program Message-ID: <61367@sgi.sgi.com> Date: 1 Jun 90 10:36:22 GMT Sender: karsh@trifolium.esd.sgi.com Reply-To: karsh@trifolium.sgi.com (Bruce Karsh) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 127 Here's a fun little graphics program. Run it when you feel that bugs are getting you down. When you've had enough, you can kill it by selecting the plain root from the Windows chest. ------------------------( Cut Here multibug.c )-------------------------------- #include "gl.h" #include "gl/device.h" #include "math.h" #define PI 3.1415926535 #define NBUGS 12 #define MAXBUGS 500 int phase[MAXBUGS]; Coord bugx[MAXBUGS],bugy[MAXBUGS]; Angle bugt[MAXBUGS]; int bugc[MAXBUGS]; int nbugs; main(argc,argv) int argc; char *argv[]; { short dev,data; int i; imakebackground(); winopen("background"); shademodel(FLAT); if(argc == 2) nbugs=atoi(argv[1]); else nbugs=NBUGS; if(nbugs > MAXBUGS)nbugs=MAXBUGS; for(i=0;i1300)bugx[i] = -35; if(bugx[i]< -35)bugx[i] = 1300; if(bugy[i] > 1050)bugy[i] = -35; if(bugy[i] < -35)bugy[i] = 1050; bugt[i] += rand() % 200 - 100; } newbug(); sginap(2); } } } repaint() { color(14); clear(); newbug(); } newbug() { int i; /* Draw the new bugs. */ for(i=0;i