[ Previous Article | Book Contents | Library Home | Legal | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

zoing.c Example C Language Program

/*
zoing.c
Make a spiral out of circles.
Paul Haeberli - 1984
*/
#include <gl/device.h>
#include <gl/gl.h>
main()
{
   short dev,val;    
   keepaspect(1,1);
   prefposition(XMAXSCREEN/4,XMAXSCREEN*3/4,YMAXSCREEN/4,
       YMAXSCREEN*3/4);
   winopen("zoing");
   qdevice(ESCKEY);
   drawit();
   while(1) {
      if((dev = qread(&val)) == REDRAW)
         drawit();
      else if (dev == ESCKEY) {
         gexit();
         exit();
      }
   }
}
drawit()
{
   register int i;    
   reshapeviewport();
   color(7);
   clear();
   ortho2(-1.0,1.0,-1.0,1.0);
   color(0);
   translate(-0.1,0.0,0.0);
   pushmatrix();
   for(i=0; i<200; i++)  {
      rotate(170,'z');
      scale(0.96,0.96,0.0);
      pushmatrix();
      translate(0.10,0.0,0.0);
      circ(0.0,0.0,1.0);
      popmatrix();
   }
   popmatrix();
}

Related Information


[ Previous Article | Book Contents | Library Home | Legal | Search ]