The easiest way to do a cube is to simply place the vertices by hand, unfortunatly. A cylinder is pretty simple. Simply use your standard sin/cos algorithm to add vertices as if you were drawing a 2D Circle, but do this in a for loop, and add to your up coordinate at each iteration of that loop (you need to generate the triangles, so it might be best to use indexed tri-lists for this).

Sphees are fun. You can do them in two ways; Latidue/Longitude spheres where triangles nearer the poles are smaller then those near the equator, and geo-spheres which have a VERY even triangle size spread. Lat/Long spheres are the easiest. Here is an algorithm (its for open GL, but the logic is there):
Code:
void CreateSphere(XYZ c,double r,int n)
{
   int i,j;
   double theta1,theta2,theta3;
   XYZ e,p;

   if (r < 0)
      r = -r;
   if (n < 0)
      n = -n;
   if (n < 4 || r <= 0) {
      //glBegin(GL_POINTS);
      //glVertex3f(c.x,c.y,c.z);
      //glEnd();
      return;
   }

   for (j=0;j<n/2;j++) {
      theta1 = j * TWOPI / n - PID2;
      theta2 = (j + 1) * TWOPI / n - PID2;

      //glBegin(GL_QUAD_STRIP);
      for (i=0;i<=n;i++) {
         theta3 = i * TWOPI / n;

         e.x = cos(theta2) * cos(theta3);
         e.y = sin(theta2);
         e.z = cos(theta2) * sin(theta3);
         p.x = c.x + r * e.x;
         p.y = c.y + r * e.y;
         p.z = c.z + r * e.z;

         // this is drawing stuff... you can ignore
         //glNormal3f(e.x,e.y,e.z);
         //glTexCoord2f(i/(double)n,2*(j+1)/(double)n);
         //glVertex3f(p.x,p.y,p.z);

         e.x = cos(theta1) * cos(theta3);
         e.y = sin(theta1);
         e.z = cos(theta1) * sin(theta3);
         p.x = c.x + r * e.x;
         p.y = c.y + r * e.y;
         p.z = c.z + r * e.z;

         //glNormal3f(e.x,e.y,e.z);
         //glTexCoord2f(i/(double)n,2*j/(double)n);
         //glVertex3f(p.x,p.y,p.z);
      }
      glEnd();
   }
}
You should be able to figure out the constants. Texture coordinates are generated (the glTexCoord2f() calls), as well as normals.

Geo-spheres are more difficult. You take any platonic solid, and subdivide each triangle, and set the new vertices at r meters from the center of the object. Continue until you have the detail you want. The most common bases for a geo-sphere are tetrahedrons, cubes, and icosahedrons.

If you do a google search for platonic solids, you should be able to find algorithms to create them.

Z.