Function:ns2vspherex
From S2PLOT
ns2vspherex
Draw a textured sphere, with given centre, radius, colour and texture ID - vector input.
Prototype
void ns2vspherex(XYZ P, float r, COLOUR col, unsigned int textureid);
Description
Draw a textured sphere, with given centre, radius, colour and using a texture id as returned by s2extloadtexture. Uses vector data structures.
See Also
Textures | Important information on using textures in S2PLOT. |
ss2lt | Load a texture for future (generally repeated) use. |
ns2sphere | Draw a sphere, with a given centre, radius and colour. |
ns2spherex | Draw a textured sphere, with given centre, radius, colour and texture ID. |
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 }; /* Position */
COLOUR col = { 1.0, 1.0, 1.0 }; /* 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 */
radius = 0.4;
texid = ss2lt(texture); /* Load for later use */
ns2vspherex(xyz, radius, col, texid); /* Draw textured sphere */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.