The EZwgl includes a few functions for generating regular polyhedra, sphere and tube.
void EZ_Tetrahedron(float x, float y, float z, float size);
This function renders a tetrahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.
void EZ_Cube(float x, float y, float z, float size);
This function renders a cube based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.
void EZ_Octahedron(float x, float y, float z, float size);
This function renders an octahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.
void EZ_Dodecahedron(float x, float y, float z, float size);
This function renders a dodecahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.
void EZ_Icosahedron(float x, float y, float z, float size);
This function renders an icosahedron based on the given size and center. It uses the current polygon mode to decide whether to render all face polygons or just to render the edges.
void EZ_Sphere(int type, int level, float x, float y, float z, float r);
This function renders a sphere based on the given information.
It uses the current polygon mode to decide whether to
render all face polygons or just to render the edges.
Types are:
EZ_SPHERE_TRIANGLE
EZ_SPHERE_QUAD
EZ_SPHERE_PARAMETRIC
void EZ_Tube(float *data, int nsegs, int nsides)
This function renders a tube based on the given data.
data
specifies a static array of floats. It should
contain 4 * nsegs
numbers. If we think of data
as an array of 4 vectors, then the first three floats of each
vector specifies a point and the last one specifies a radius.
nsegs
specifies the number of segments in data
.
nsides
specifies the number of sides for each radial
section.
For example, the following code draws a cone.
static float cone[] = {
-1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.5,
1.0, 0.0, 0.0, 1.0,
};
EZ_Tube(cone, 3, 16);