Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
   s2opend("/?",argc, argv);			/* Open the display */
   s2svp(-1.,0., -1.,1., -1.,1.);		/* First view port */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   s2sci(S2_PG_RED);
   s2svp(0.5,1., -1.,1., -1.,1.);		/* Second viewport */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */
   
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
   int width = 16, height = 16;		/* Dimensions of texture */
   int i, j;				/* Loop variables */
   int idx;				/* Index into texture array */
   unsigned char *tex;				/* Array of texture values */

   srand48((long)time(NULL));			/* Seed random numbers */
   s2opend("/?",argc,argv);			/* Open the display */
   s2svp(-1.0,1.0, -1.0,1.0, -1.0,1.0);		/* Set the viewport coords */
   s2swin(-1.0,1.0, -1.0,1.0, -1.0,1.0);	/* Set the window coordinates */
   s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);	/* Draw a bounding box */

   tid = ss2ct(width, height);		/* Create a new texture */
   tex = ss2gt(tid, &width, &height);	/* Get the texture */

   for (j=0;j<height;j++) {
      for (i=0;i<width;i++) {
         idx = (j*width + i) * 4;		/* Stored as (r,g,b,alpha) */
         tex[idx  ] = 127*drand48()+128;	/* Randomish red */
         tex[idx+1] = 0;			/* Green */
         tex[idx+2] = 0;			/* Blue */
						/* Do nothing to alpha */
      }
   }
   ss2pt(tid);				/* Push texture for usage */

   cs2scb(&cb);				/* Install a callback */

   s2show(1);				/* Open the s2plot window */

   return 1;
}