Contents /
Previous /
Next
Quadrics Primitives
- void gluSphere (GLUquadricObj *
qobj, GLdouble radius,
GLint slices, GLint stacks);
Draws a sphere of the given radius, centered around
the origin, (0, 0, 0). The sphere is subdivided around the z axis into a number
of slices (similar to longitude) and along the z axis into a
number of stacks (latitude).
If texture coordinates are also generated by the quadrics facility, the
t coordinate ranges from 0.0 at z = -radius to 1.0 at z = radius, with t
increasing linearly along longitudinal lines. Meanwhile, s ranges from 0.0 at
the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 at the -x
axis, and back to 1.0 at the +y axis.
void gluCylinder (GLUquadricObj *qobj,
GLdouble baseRadius,GLdouble topRadius, GLdouble height,
GLint slices, GLint stacks);
Draws a cylinder oriented along the z axis, with the base of the
cylinder at z = 0 and the top at z = height. Like a sphere, the cylinder is
subdivided around the z axis into a number of slices and
along the z axis into a number of
stacks. baseRadius is the radius of the
cylinder at z = 0. topRadius is the radius of the cylinder at
z = height. If topRadius is set to zero, then a cone is
generated.
If texture coordinates are generated by the quadrics facility, then the t coordinate ranges linearly from 0.0 at z = 0 to 1.0 at z = height. The s texture coordinates are generated the same way as they are for a sphere.
Note: The cylinder is not closed at the top or bottom. The disks
at the base and at the top are not drawn.
- void gluDisk (GLUquadricObj *
qobj,
GLdouble innerRadius,
GLdouble outerRadius, GLint slices, GLint rings);
Draws a disk on the z = 0 plane, with a radius of
outerRadius and a concentric circular hole with a radius of
innerRadius. If innerRadius is 0, then no
hole is created. The disk is subdivided around the z axis into a number of
slices (like slices of pizza) and also about the z axis into
a number of concentric rings.
With respect to orientation, the +z side of the disk is considered to be "outside"; that is, any normals generated point along the +z axis. Otherwise, the normals point along the -z axis.
If texture coordinates are generated by the quadrics facility, then the texture coordinates are generated linearly such that where R=outerRadius, the values for s and t at (R, 0, 0) is (1, 0.5), at (0, R, 0) they are (0.5, 1), at (-R, 0, 0) they are (0, 0.5), and at (0, -R, 0) they are (0.5, 0).
void gluPartialDisk (GLUquadricObj *qobj,
GLdouble innerRadius,
GLdouble outerRadius, GLint slices, GLint rings,
GLdouble startAngle, GLdouble sweepAngle);
Draws a partial disk on the z = 0 plane. A partial disk is similar to a
complete disk, in terms of outerRadius,
innerRadius, slices, and
rings. The difference is that only a portion of a partial
disk is drawn, starting from startAngle through
startAngle+sweepAngle (where
startAngle and sweepAngle are measured in
degrees, where 0 degrees is along the +y axis, 90 degrees along the +x axis,
180 along the -y axis, and 270 along the -x axis).
Note: For all quadrics objects, it's better to use the
*Radius, height, and similar arguments to scale them
rather than the glScale*() command so that the unit-length normals that
are generated don't have to be renormalized. Set the rings and
stacks arguments to values other than one to force lighting
calculations at a finer granularity, especially if the material specularity is
high.