how to draw disks and cylinders in opengl

How do you draw disks and cylinders in opengl?Are there any standard functions?

Quadrics, look at NeHe tutorials.

In the glu library, you have gluCylinder and
gluDisk.

GLUquadricObj *quadric // Create pointer for storage space for object

//example
GLUquadricObj *Cylinder; // Create pointer for our cylinder

Cylinder = gluNewQuadric(); // Create our new quadric object
gluQuadricDrawStyle( Cylinder, GLU_FILL); //FILL also can be line(wire)
gluQuadricNormals( Cylinder, GLU_SMOOTH); // For if lighting is to be used.
gluQuadricOrientation( Cylinder,GLU_OUTSIDE);
gluQuadricTexture( Cylinder, GL_TRUE);// if you want to map a texture to it.

// Draw
gluCylinder( Cylinder, bottom, top, length, slices_vertical, slices_horisontal );

// example of disk
gluDisk( *quadric, inside_diameter, outside_diameter, slices_vertical, slices_horisontal)

You can do a search on the main page of this site for the spec’s on the glu commands, just enter the glu command and you will get the information on usage.

Originally posted by karteek:
How do you draw disks and cylinders in opengl?Are there any standard functions?