Porting Spheres

When porting spheres to OpenGL, keep the following points in mind:

  • You cannot control the type of primitives used to draw the sphere. You can control drawing precision in another way: use the slices and stacks parameters. Slices are longitudinal; stacks are latitudinal.
  • Spheres are drawn centered at the origin. Instead of specifying the location, as you do with the IRIS GL sphdraw function, precede a call to the GLU gluSphere function with a translation.
  • The sphere library is not yet available for OpenGL.

The following table lists the IRIS GL functions for drawing spheres and their equivalent GLU functions where available.

IRIS GL function GLU function Meaning
sphobj gluNewQuadric Creates a new sphere object.
sphfree gluDeleteQuadric Deletes sphere object and free memory used.
sphdraw gluSphere Draws a sphere.
sphmode Sets sphere attributes.
sphrotmatrix Controls sphere orientation.
sphgnpolys Returns number of polygons in current sphere.

 

??