Function:ns2vi
From S2PLOT
Revision as of 01:22, 30 October 2007; view current revision
←Older revision | Newer revision→
←Older revision | Newer revision→
ns2vi
Illumination - vector input.
Prototype
void nsv2i(XYZ P, COLOUR col);
Description
Place an OpenGL light at location (P) with RGB colour col, using vector data structures.
See Also
ns2i | Illumination. |
struct_COLOUR | Data structure for (r,g,b) colour indices. |
struct_XYZ | Data structure for (x,y,z) coordinates. |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"
int main(int argc, char *argv[])
{
XYZ xyz = { 0.0, 0.0, 0.0 };
COLOUR col = { 1.0, 1.0, 1.0 }; /* White */
float radius = 0.2; /* Sphere radius */
XYZ light = { 0.0, 0.3, 0.8 }; /* Light position */
COLOUR lcol = { 0.0, 0.0, 1.0 }; /* A blue light */
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 */
ns2vsphere(xyz, radius, col); /* Draw a sphere */
ns2vi(light, lcol); /* Put the light in */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.