
Jonathan C. answered 04/26/19
Game-Programming Computer Tutor
There are a few techniques that work for generating spheres.
Primary ones are:
Polar Coordinates: Translating polar or spherical coordinates into cartesian ones
Normalized Cube: starting with a subdivided unit cube (extents (-1,-1,-1) to (1,1,1)) and normalizing the verticies.
This article contains some psuedocode that may help you:
https://medium.com/game-dev-daily/four-ways-to-create-a-mesh-for-a-sphere-d7956b825db4
There is a more detailed explanation on of using a normalized cube method his website, which also covers calculating a continuous tangent space.
https://www.iquilezles.org/www/articles/patchedsphere/patchedsphere.htm
Hopefully these links will help you generate the sphere verticies, the indicies might be a bit of trouble.
The normalized cube technique is probably the easiest way, since it is fairly easy to generate a subdivided cube mesh with proper indicies one quad at a time.
Generating a sphere using polar coordinates is a bit more difficult, and the result is arguably a bit worse.
Note: if you do decide to use the Polar Coordinates method, what the medium author calls "UV Sphere"/"Standard Sphere" is using polar coordinates, which are angles.
spherical_to_cartesian in that example is likely something doing something like the following (which the medium author does not have in his own article)
Also Psuedocode, for simplicity.