Difference between revisions of "IrisGL"

From Nekochan
Jump to: navigation, search
m (Example)
m (Example: typo)
Line 10: Line 10:
 
  //written by Ruud van Gaal
 
  //written by Ruud van Gaal
 
  //ruud at racer dot nl
 
  //ruud at racer dot nl
  //complie with CC -o saver ssaver.cpp -lgl -ldmedia
+
  //compile with CC -o saver ssaver.cpp -lgl -ldmedia
 
  //note that IrisGL is linked with lowercase gl while
 
  //note that IrisGL is linked with lowercase gl while
 
  //OpenGL is linked with uppercase gl (-lGL)
 
  //OpenGL is linked with uppercase gl (-lGL)

Revision as of 15:29, 19 December 2006

IRIS GL (Integrated Raster Imaging System Graphics Library) was a proprietary graphics API created by Silicon Graphics for producing 2D and 3D computer graphics on their IRIX based IRIS graphical workstations. Later sgi (Silicon Graphics, Inc.) removed their proprietary code, reworked various system calls, and released IRIS GL as the industry standard OpenGL.

History

Example

IrisGL is straight forward, an example for a simple screensaver:

//ssaver.cpp
//written by Ruud van Gaal
//ruud at racer dot nl
//compile with CC -o saver ssaver.cpp -lgl -ldmedia
//note that IrisGL is linked with lowercase gl while
//OpenGL is linked with uppercase gl (-lGL)
#include <gl/gl.h>
#include <gl/device.h>
#include <dmedia/dmedia.h>
void Line(int x1,int y1,int x2,int y2)
{ short v[2];
 bgnline();
   v[0]=x1; v[1]=y1; v2s(v);
   v[0]=x2; v[1]=y2; v2s(v);
 endline();
}
#define MAXX 1280               // getgdesc(GD_XPMAX)
#define MAXY 1024
void main(int argc,char **argv)
{ int x1,y1,x2,y2;
 int v[2][2];
 prefsize(1280,1024);
 winopen("GL window");
 RGBmode();
 doublebuffer();
 //viewport(0,768,0,576);
 fullscrn();
 gconfig();
 //winposition(100,200,100,200);
 //imakebackground();
 clear();
 v[0][0]=1; v[0][1]=2;
 v[1][0]=3; v[1][1]=4;
 x1=100; y1=150; x2=400; y2=400;
 qdevice(ESCKEY);
 clear(); swapbuffers();
 clear(); //swapbuffers();
 while(1)
 { cpack(0); clear();
   x1=x1+v[0][0]; if(x1<0||x1>=MAXX){ v[0][0]=-v[0][0]; x1=x1+v[0][0];      }
   y1=y1+v[0][1]; if(y1<0||y1>=MAXY){ v[0][1]=-v[0][1]; y1=y1+v[0][1];      }
   x2=x2+v[1][0]; if(x2<0||x2>=MAXX){ v[1][0]=-v[1][0]; x2=x2+v[1][0];      }
   y2=y2+v[1][1]; if(y2<0||y2>=MAXY){ v[1][1]=-v[1][1]; y2=y2+v[1][1];      }
   cpack(0xFFFFFFFF);
   Line(x1,y1,x2,y2);
   swapbuffers();
   if(qtest())
   { short data;
     if(qread(&data)==ESCKEY)
     break;
   }
 }
}

References

External links