Function:ns2spherex

From S2PLOT

Jump to: navigation, search

ns2spherex

Draw a textured sphere, with given centre, radius, colour and texture ID.

Prototype

void ns2spherex(float x, float y, float z, float r, float red, float green, float blue, unsigned int textureid);

Description

Draw a textured sphere, with given centre, radius, colour and using a texture id as returned by s2extloadtexture.

See Also

Textures Important information on using textures in S2PLOT.
ss2lt Load a texture for future (generally repeated) use.
ns2vspherex Draw a textured sphere, with given centre, radius, colour and texture ID - vector input.
ns2sphere Draw a sphere, with a given centre, radius and colour.


Code Example

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

int main(int argc, char *argv[])
{
   float x, y, z;				/* Position */
   float r, g, b;				/* Colour */
   float radius;				/* Radius */
   char *texture = "firetile2_pow2_rgb.tga";
		/* Texture in directory pointed to by S2PLOT_TEXPATH */
   int texid;

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

   x = 0.0; y = 0.0; z = 0.0;			/* Set position */
   r = 0.0; g = 0.0; b = 0.0;			/* Set colour */
   radius = 0.4;

   texid = ss2lt(texture);			/* Load for later use */ 

   ns2spherex(x,y,z, radius, r,g,b, texid);	/* Draw textured sphere */

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

Back to S2PLOT function list.


Personal tools