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 */ }
void ncb(int *N) /* Callback for pressing number keys */ { if (*N > 5) return; /* Do nothing! */ switch (*N) { case 1 : cs2dcb(); /* Turn off callback */ break; case 2 : cs2ecb(); /* Turn on callback */ break; case 3 : colour = 3; /* Change the colour that alternates */ break; case 4 : colour = 5; /* Change the colour that alternates */ break; case 5 : cs2tcb(); /* Toggle callback on/off */ break; } }