Function:ss2srm

From S2PLOT

(Difference between revisions)
Jump to: navigation, search

Revision as of 01:19, 30 October 2007

ss2srm

Set the rendering mode.

Prototype

void ss2srm(int mode);

Description

Set the rendering mode. Options are:

  • WIREFRAME
  • SHADE_FLAT
  • SHADE_DIFFUSE
  • SHADE_SPECULAR

See Also

ss2qrm Get the rendering mode.


Code Example

#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"

#define WIREFRAME		0
#define SHADE_FLAT		1
#define SHADE_DIFFUSE		2	
#define SHADE_SPECULAR 		3

void numcb(int *N)
{
   switch(*N) {					/* Set the render mode */
      case 1  : ss2srm(WIREFRAME); break;	
      case 2  : ss2srm(SHADE_FLAT); break;	
      case 3  : ss2srm(SHADE_DIFFUSE); break;	
      case 4  : ss2srm(SHADE_SPECULAR); break;
      default : return;
   }
   cs2tcb();					/* Turn the callback back on */
}

void cb(double *t, int *kc)
{
   float x, y, z;				/* Position */
   float r, g, b;				/* Colour */
   float radius = 0.3;				/* Radius */

   x = 0.0; y = 0.0; z = 0.0;			
   r = 1.0; g = 1.0; b = 1.0;			/* Yellow */
   ns2sphere(x,y,z, radius, r,g,b);		/* Draw the sphere */

   cs2tcb();		/* Temporarily turn-off callback */

}

int main(int argc, char *argv[])
{

   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   cs2scb(&cb);					/* Install callback */
   cs2sncb(&numcb);				/* Install number callback */

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

Back to S2PLOT function list.


Personal tools