sphere and cylinder

Can anyone help me with making a sphere and cylinder algorithm. Thanks.

P.S. I don’t want to use the glu functions.

Pretty sure Opengl superbible has that stuff.