/* Program to create moire effects with SVGALIB in 256-color modes */ #include #include #define C 8 #define SR(x) srand48(x) #define R() (lrand48()) main() { int x,y,z,color; int c[C][4]; vga_init(); vga_setmode(G640x480x256); gl_setcontextvga(G640x480x256); gl_setrgbpalette(); SR(getpid()); for(y=0;yc[y][2]){c[y][3]=1-c[y][3];c[y][2]+=c[y][c[y][3]];} } gl_line(320,240,x,0,color); z++; } for(x=0;x<480;x++) { color=0; for(y=0;yc[y][2]){c[y][3]=1-c[y][3];c[y][2]+=c[y][c[y][3]];} } gl_line(320,240,639,x,color); z++; } for(x=639;x>=0;x--) { color=0; for(y=0;yc[y][2]){c[y][3]=1-c[y][3];c[y][2]+=c[y][c[y][3]];} } gl_line(320,240,x,479,color); z++; } for(x=479;x>=0;x--) { color=0; for(y=0;yc[y][2]){c[y][3]=1-c[y][3];c[y][2]+=c[y][c[y][3]];} } gl_line(320,240,0,x,color); z++; } } }