OpenGLEAN
OpenGLEAN Shapes User Support
Home page | Introduction | Documentation | Files | Examples | Proposals | Authors | Links


OpenGLEAN Shapes Development
Summary | CVS | (discussion via home page) | (contact via home page) | (suggestion box) | License | Todo | Bugs

Geometric Rendering
[OpenGLEAN Shapes API Reference]

Collaboration diagram for Geometric Rendering:


Functions

void glutSolidCone (GLdouble base, GLdouble height, GLint slices, GLint stacks)
void glutSolidCube (GLdouble width)
void glutSolidCuboctahedron (GLdouble s)
void glutSolidCylinder (GLdouble radius, GLdouble height, GLint slices, GLint stacks)
void glutSolidDodecahedron (void)
void glutSolidIcosahedron (void)
void glutSolidOctahedron (void)
void glutSolidRhombicDodecahedron (void)
void glutSolidSierpinskiSponge (int num_levels, const GLdouble offset[3], GLdouble scale)
void glutSolidSphere (GLdouble radius, GLint slices, GLint stacks)
void glutSolidTeapot (GLdouble size)
void glutSolidTetrahedron (void)
void glutSolidTorus (GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings)
void glutWireCone (GLdouble base, GLdouble height, GLint slices, GLint stacks)
void glutWireCube (GLdouble width)
void glutWireCuboctahedron (GLdouble s)
void glutWireCylinder (GLdouble radius, GLdouble height, GLint slices, GLint stacks)
void glutWireDodecahedron (void)
void glutWireIcosahedron (void)
void glutWireOctahedron (void)
void glutWireRhombicDodecahedron (void)
void glutWireSierpinskiSponge (int num_levels, const GLdouble offset[3], GLdouble scale)
void glutWireSphere (GLdouble radius, GLint slices, GLint stacks)
void glutWireTeapot (GLdouble size)
void glutWireTetrahedron (void)
void glutWireTorus (GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings)

Detailed Description

These functions originally were part of the GLUT API, though not all were implemented in the original GLUT, and none of the code came from there. OpenGLEAN was the first GLUT family member to see some off these functions. In general, any GLUT family geometric shape function can be found in this library.

The goals are:

A problem with these functions is that they are widely varying in their parameters. Some take no parameters at all. Some allow you to specify mesh densities. For purposes of lighting, even simple, single planes sometimes benefit from finer mesh densities. Most objects are drawn at 1 unit radius, but some use other sizes (such as sqrt(3) radius).

This library provides some elementary objects that are more or less standard fare for computer graphics. The objects all provide surface normals.

Contains numerous fixes relative to the freeglut code from which OpenGLUT sprang, which had many bugs with the winding of facets. Those fixes were made in OpenGLUT and freeglut lifted the fixes back (without crediting the hard work of the OpenGLUT project, alas). (Ironically, because freeglut was uncritically lifting OpenGLUT code, they were unaware of some of the fixes that they received in the process of blindly copying OpenGLUT work. By mixing and matching unmodified freeglut code and OpenGLUT code, freeglut further introduced bugs to their bitmapped font rendering, but that's a story for another time.)


Function Documentation

void glutSolidCone GLdouble  base,
GLdouble  height,
GLint  slices,
GLint  stacks
 

Draw a solid cone.

Parameters:
base Cone radius at the base in the xy plane.
height Height of cone in positive z direction.
slices The number of divisions around the z axis. (latitudal)
stacks The number of divisions along the z axis. (longitudal)
The glutSolidCone() function draws a shaded cone with a base in the xy-plane, oriented in the positive z direction.

Note:
The number of polygons representing the conical surface is proportional to (slices*stacks).
See also:
glutWireCone()

void glutSolidCube GLdouble  width  ) 
 

Draw a solid cube centered at the origin.

Parameters:
width The width, height and depth of the cube.
The glutSolidCube() function draws a solid-shaded cube with side-length given by width. The vertices of the cube are at (+/- width/2, +/- width/2, +/- width/2), so that the cube is centered at the origin.

Author:
Code contributed by Andreas Umbach <marvin@dataway.ch>
See also:
glutWireCube()

void glutSolidCuboctahedron GLdouble  s  ) 
 

Draw a solid "cuboctahedron".

Parameters:
s Scale factor.
A cuboctahedron is described by John Fay as a cube with the corners sliced off just deeply enough that each of the facets (where the corners were) touch one another. The result is that the 6 square faces of the original cube are still square, but smaller (and 45 degrees rotated in their planes), while 8 new equilateral facets are added at what used to be the corners.

The scaling parameter, s, allows you to adjust the size of the resulting object.

The object is centered at the origin.

See also:
glutWireCuboctahedron

void glutSolidCylinder GLdouble  radius,
GLdouble  height,
GLint  slices,
GLint  stacks
 

Draw a solid cylinder.

Parameters:
radius Radius of the cylinder.
height Z height.
slices Divisions around z axis.
stacks Divisions along z axis.
glutSolidCylinder() draws a shaded cylinder, the center of whose base is at the origin and whose axis is along the positive z axis.

See also:
glutWireCylinder()

void glutSolidDodecahedron void   ) 
 

Draw a solid dodecahedron.

This function draws a regular, solid, 12-sided polyhedron centered at the origin. The distance from the origin to the vertices is sqrt(3). The facets are pentagons.

See also:
glutWireDodecahedron(), glutSolidRhombicDodecahedron(), glutWireRhombicDodecahedron()

void glutSolidIcosahedron void   ) 
 

Draw a solid icosahedron.

This function draws a regular, solid 20-sided polyhedron centered at the origin. The distance from the origin to the vertices is 1.

See also:
glutWireIcosahedron()

void glutSolidOctahedron void   ) 
 

Draw a solid octahedron.

This function draws a regular, solid 8-sided polyhedron centered at the origin. The vertices are at (+/-1, 0, 0), (0, +/-1, 0), (0, 0, +/-1).

Note:
We visit the same vertices the same number of times as in the wire octahedron, but the order is different.
See also:
glutWireOctahedron()

void glutSolidRhombicDodecahedron void   ) 
 

Draw a solid rhombic dodecahedron

This function draws a solid-shaded dodecahedron whose facets are rhombic and whose vertices are at unit radius. No facet lies normal to any coordinate axes. The polyhedron is centered at the origin.

See also:
glutWireRhombicDodecahedron(), glutWireDodecahedron(), glutSolidDodecahedron()

void glutSolidSierpinskiSponge int  num_levels,
const GLdouble  offset[3],
GLdouble  scale
 

Draw a solid Spierspinski's sponge.

Parameters:
num_levels Recursive depth.
offset Location vector.
scale Relative size.
This function recursively draws a few levels of a solid-shaded Sierpinski's Sponge. If num_levels is 0, draws 1 tetrahedron. The offset is a translation. The z axis is normal to the base. The sponge is centered at the origin.

Note:
Runtime is exponential in num_levels .
See also:
glutWireSierpinskiSponge()
Todo:
Consider removing the offset parameter from the API (use a helper function).

num_levels should really be unsigned.

Here is the call graph for this function:

void glutSolidSphere GLdouble  radius,
GLint  slices,
GLint  stacks
 

Draw a solid sphere centered at the origin.

Parameters:
radius Sphere radius.
slices The number of divisions around the z axis. (latitudal)
stacks The number of divisions along the z axis. (longitudal)
The glutSolidSphere() function draws a shaded sphere centered at the origin. The surface is created from quadrangles (except for triangles as degenerate quads at the poles) in a longitude/latitude pattern. The equatorial great circle lies in the xy-plane and is centered on the origin.

Note:
The number of polygons representing the spherical surface is proportional to (slices*stacks).
See also:
glutWireSphere()

void glutSolidTeapot GLdouble  size  ) 
 

Draw a solid teapot.

Parameters:
size Scale factor.
Draws the standard Teapot, solid shaded, using OpenGL evaluators. This is the classic "Utah Teapot" of computer graphics. The base should lie in the xy-plane with "up" being along the positive z axis.

This is derived from SGI code. It should also be the same as the teapot modeled by Martin Newell in 1975.

Note:
Uses a higher mesh density than the "wire" teapot.
See also:
glutWireTeapot()

void glutSolidTetrahedron void   ) 
 

Draw a solid tetrahedron.

This function draws a regular, solid 4-sided polyhedron centered at the origin. The distance from the origin to the vertices is 1.

See also:
glutWireTetrahedron()
Todo:
See todo-list on glutWireTetrahedron().

void glutSolidTorus GLdouble  dInnerRadius,
GLdouble  dOuterRadius,
GLint  nSides,
GLint  nRings
 

Draw a solid torus.

Parameters:
dInnerRadius Radius of ``tube''
dOuterRadius Radius of ``path''
nSides Facets around ``tube''
nRings Joints along ``path''
This function effectively wraps a cylinder with nSides slats and bends it at nRings facets around a circular path, forming a torus, or ``donut''. The center is at the origin and the ``path'' rings around the z axis.

The torus parameters can be explored interactively with the OpenGLEAN shapes demo.

Note:
dInnerRadius and dOuterRadius are not analogous to similar measurements of an anulus.
See also:
glutWireTorus()

void glutWireCone GLdouble  base,
GLdouble  height,
GLint  slices,
GLint  stacks
 

Draw a wireframe cone.

Parameters:
base Cone radius at the base in the xy plane.
height Height of cone in positive z direction.
slices The number of divisions around the z axis. (latitudal)
stacks The number of divisions along the z axis. (longitudal)
The glutWireCone() function draws a wireframe cone with a base in the xy plane oriented in positive z.

Note:
The number of line segments representing the conical surface is proportional to (slices*stacks).
See also:
glutSolidCone()

void glutWireCube GLdouble  width  ) 
 

Draw a wireframe cube centered at the origin.

Author:
Code contributed by Andreas Umbach <marvin@dataway.ch>
Parameters:
width The width, height and depth of the cube.
The glutWireCube() function draws an axis-aligned wireframe cube with a specified width, height and depth. The vertices of the cube are at (+/- width/2, +/- width/2, +/- width/2), so that the cube is centered at the origin.

See also:
glutSolidCube()

void glutWireCuboctahedron GLdouble  s  ) 
 

Draw a wireframe "cuboctahedron".

Parameters:
s Scale factor.
A cuboctahedron is described by John Fay as a cube with the corners sliced off just deeply enough that each of the facets (where the corners were) touch one another. The result is that the 6 square faces of the original cube are still square, but smaller (and 45 degrees rotated in their planes), while 8 new equilateral facets are added at what used to be the corners.

The scaling parameter, s, allows you to adjust the size of the resulting object.

The object is centered at the origin.

Note:
Unlike most wireframe objects, this one traces its edges exactly once.
See also:
glutSolidCuboctahedron
Bug:
Normals are computed relative to the square faces, so every facet set of 4 lines has a single normal (and the normals of the triangle faces are ignored).

void glutWireCylinder GLdouble  radius,
GLdouble  height,
GLint  slices,
GLint  stacks
 

Draw a wireframe cylinder.

Parameters:
radius Radius of cylinder.
height Z height.
slices Number of divisions around the z axis.
stacks Number of divisions along the z axis.
glutWireCylinder() draws a wireframe of a cylinder, the center of whose base is at the origin, and whose axis parallels the z axis.

See also:
glutSolidCylinder()

void glutWireDodecahedron void   ) 
 

Draw a wireframe dodecahedron.

This function draws a regular, wireframe 12-sided polyhedron centered at the origin. The distance from the origin to the vertices is sqrt(3). The facets are pentagons. No facet is normal any of the x, y, or z axes.

See also:
glutSolidDodecahedron(), glutWireRhombicDodecahedron(), glutSolidRhombicDodecahedron()

void glutWireIcosahedron void   ) 
 

Draw a wireframe icosahedron.

This function draws a regular, solid 20-sided polyhedron centered at the origin. The distance from the origin to the vertices is 1. No facet is normal to any of the x, y, or z axes.

See also:
glutSolidIcosahedron()

void glutWireOctahedron void   ) 
 

Draw a wireframe octahedron.

This function draws a regular wireframe 8-sided polyhedron centered at the origin. The vertices are at (+/-1, 0, 0), (0, +/-1, 0), (0, 0, +/-1).

Note:
We visit the same vertices the same number of times as for the solid octahedron, but the order is different.

Draws every edge twice.

The lines have normals, but the normals are from the facets, rather than upon the edge. If you squint too hard, the lighting on a wireframe octahedron does not look quite right.

See also:
glutSolidOctahedron()
Todo:
It may be faster (and look better) to draw each edge once, setting the Normal at each edge. (I don't think that this matters all that much, but a lineloop was proposed for the wire Cube for speed.)

void glutWireRhombicDodecahedron void   ) 
 

Draw a wireframe rhombic dodecahedron

This function draws a wireframe dodecahedron whose facets are rhombic and whose vertices are at unit radius. No facet lies normal to any coordinate axes. The polyhedron is centered at the origin.

See also:
glutSolidRhombicDodecahedron(), glutWireDodecahedron(), glutSolidDodecahedron()

void glutWireSierpinskiSponge int  num_levels,
const GLdouble  offset[3],
GLdouble  scale
 

Draw a wireframe Spierspinski's sponge.

Parameters:
num_levels Recursive depth.
offset Location vector.
scale Relative size.
This function recursively draws a few levels of Sierpinski's Sponge in wireframe. If num_levels is 0, draws 1 tetrahedron. The offset is a translation. The z axis is normal to the base. The sponge is centered at the origin.

Note:
Runtime is exponential in num_levels .
See also:
glutSolidSierpinskiSponge()
Todo:
Refer to the TODO entries for glutWireSierpinksySponge().

Here is the call graph for this function:

void glutWireSphere GLdouble  radius,
GLint  slices,
GLint  stacks
 

Draw a wireframe sphere centered at the origin.

Parameters:
radius Sphere radius.
slices The number of divisions around the z axis. (latitudal)
stacks The number of divisions along the z axis. (longitudal)
The glutWireSphere() function draws a wireframe sphere centered at the origin. The "equatorial" great circle lies in the xy-plane.

Note:
The number of line segments representing the spherical surface is proportional to (slices*stacks).
See also:
glutSolidSphere().

void glutWireTeapot GLdouble  size  ) 
 

Draw a wireframe teapot.

Parameters:
size Scale factor.
This function draws the standard Teapot in wireframe using OpenGL evaluators. This is the classic "Utah Teapot" of computer graphics. The base should lie in the xy-plane with "up" being along the positive z axis.

This is derived from SGI code. It should also be the same as the teapot modeled by Martin Newell in 1975.

Note:
Uses a lower mesh density than the "solid" teapot.
See also:
glutSolidTeapot()

void glutWireTetrahedron void   ) 
 

Draw a wireframe tetrahedron.

This function draws a regular, wireframe 4-sided polyhedron centered at the origin. The distance from the origin to the vertices is 1.

See also:
glutSolidTetrahedron()
Todo:
Merge r0 r1 r2 and r3 into one array.

Put the normals into the (or an) array.

Make the array static const, with file scope, and share with glutSolidTetrahedron().

Maybe consolidate with the SierpinskySponge?

void glutWireTorus GLdouble  dInnerRadius,
GLdouble  dOuterRadius,
GLint  nSides,
GLint  nRings
 

Draw a wireframe torus.

Parameters:
dInnerRadius Radius of ``tube''
dOuterRadius Radius of ``path''
nSides Facets around ``tube''
nRings Joints along ``path''
This function effectively wraps a cylinder with nSides slats and bends it at nRings facets around a circular path, forming a torus, or ``donut''. The center is at the origin and the ``path'' rings around the z axis.

The torus parameters can be explored interactively with the OpenGLEAN shapes demo.

Note:
dInnerRadius and dOuterRadius are not analogous to similar measurements of an anulus.
See also:
glutSolidTorus()




SourceForge.net Logo Supported in part by SourceForge.net.

Generated on Fri Sep 9 18:03:40 2005 for OpenGLEAN'sgleanshapes by doxygen 1.4.3
The OpenGLEAN project is hosted by SourceForge.