Function:ns2i

From S2PLOT

Jump to: navigation, search

ns2i

Illumination.

Prototype

void ns2i(float x, float y, float z, float red, float green, float blue);

Description

Place an OpenGL light at location (x,y,z) with RGB colour (red,green,blue).

See Also

ns2vi Illumination - vector input.


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 */
   float lx, ly, lz;				/* Light position */
   float lr, lg, lb;				/* Light colour */

   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 */

   lx = 0.0; ly = 0.3; lz = 0.8; 		/* Light position */ 
   lr = 0.0; lg = 0.0; lb = 1.0; 		/* A blue light */ 

   ns2vsphere(xyz, radius, col);		/* Draw a sphere */
   ns2i(lx,ly,lz, lr,lg,lb);			/* Put the light in */

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

Back to S2PLOT function list.


Personal tools