Atomic Ball & Stick Model

I must come up with a model for a molecule.
How do you utilise gluSphere and coordinates
so that various ‘atoms’(the spheres) can be placed at certain locations.

gluSphere is a glu Quadric.
Here’s some code:

GlUquadric *mySphere;
mySphere = gluNewQuadric();
// Draw the sphere, we give a pointer to the quadric object
// followed by the radius of the sphere, the
// slices and the stacks. The radius speeks
// for itself. Slices and stacks is how
// smooth you want your sphere.
gluSphere(mySphere, 10, 20, 20);
// Termination
mySphere = NULL;

Initialization and Termination should be done usually only once and not every frame. Also search google for gluSphere and other glu functions. There are a lot of parameters you can define on how you want your object to be drawn.

[This message has been edited by moucard (edited 03-17-2004).]

Thanks for that code, but how do I allocate each sphere with its own coordinates to place them at different positions?

Use glTranslatef to move to a desired location and then draw your sphere there. Repeat as required.