LIBSPHERE(3L)LIBSPHERE(3L)NAMElibsphere - the Sphere Library
SYNOPSIS
#include <gl/sphere.h>
int sphdraw(params)
float params[4];
int sphgnpolys(void)
void sphfree(void)
int sphmode(attribute, value)
int attribute, value;
void sphobj(objid)
Object objid;
void sphrotmatrix(mat)
Matrix mat;
void sphbgnbitmap(void)
void sphendbitmap(void)
void sphcolor(clr)
float clr[4];
DESCRIPTION
The Sphere Library renders spheres by issuing GL calls. sphdraw draws a
sphere. sphmode sets various attributes that affect the speed and
quality of spheres rendered by sphdraw. sphrotmatrix allows you to
control the orientation of spheres by providing a rotation matrix.
sphgnpolys returns the number of polygons per sphere, in the mode
currently selected by sphmode. sphobj operates like sphdraw, except
that, instead of immediately rendering a sphere, it creates and returns a
GL object, which can be rendered using callobj. The routines
sphbgnbitmap and sphendbitmap are for drawing collections of spheres
using a special bitmap image of a phong-shaded sphere. The diffuse color
of the bitmap spheres are set with the routine sphcolor.
USAGE
To link a program with libsphere, specify -lsphere on the compile line.
When linking a program with libsphere, you must also specify the Graphics
Library, -lgl_s, and the Math Library, -lm.
CAVEAT
In the current implementation, the Sphere Library maintains an internal
cache of GL objects, one for each combination of sphere attributes for
which sphdraw or sphobj has been called. The first call to sphdraw, or
sphobj, with a combination of attributes that has not yet been rendered
Page 1
LIBSPHERE(3L)LIBSPHERE(3L)
will result in the creation of a new GL object and, thus, will take
longer than subsequent calls with the same combination of sphere
attributes.
If your program uses the Sphere Library and also manipulates its own GL
objects, you must be careful that your allocation of object identifiers
does not conflict with the Sphere Library's allocation of object
identifiers for its internal cache. The Sphere Library calls genobj for
its object identifier allocation. If your program allocates object
identifiers for its own use, you should either use genobj to allocate
object identifiers or use isobj to verify that any object identifiers
your program generates are not already being used by the Sphere Library.
See makeobj(3g) and genobj(3g) for further discussion of object
identifiers.
If you need to free the virtual memory used by the Sphere Library's
internal cache, you can call sphfree to free all its GL objects and their
associated memory.
SEE ALSO
sphdraw, sphgnpolys, sphfree, sphmode, sphobj, sphrotmatrix,
sphbgnbitmap, , sphendbitmap, sphcolor
Page 2