Function:ss2qrm
From S2PLOT
Revision as of 01:20, 30 October 2007; view current revision
←Older revision | Newer revision→
←Older revision | Newer revision→
ss2qrm
Get the rendering mode.
Prototype
int ss2qrm();
Description
Get the rendering mode. Options are:
- WIREFRAME
- SHADE_FLAT
- SHADE_DIFFUSE
- SHADE_SPECULAR
See Also
ss2srm | Set 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)
/* Callback for pressing number key - this example does same as pressring 'R' */
{
int mode = ss2qrm(); /* Current render mode */
mode = (mode + 1) % 4; /* Next render mode */
switch(*N) {
case 1 : ss2srm(mode); break; /* Set the render mode */
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.