rendered paste body // calculate the delta angle
double dangle = 2.0 * PI / (NVERTICES - 1);
// set radius to be 3
double r = 3;
double a, b, c;
a = b = c = r;
for(int i=0;i<NVERTICES;i++)
{
// caculate cos phi
double cosphi = cos(dangle * i);
// caculate sin phi
double sinphi = sin(dangle * i);
for (int j=0;j<NVERTICES;j++)
{
// calculate cos theta
// calculate sin theta
double costheta = cos(dangle * j);
double sintheta = sin(dangle * j);
mesh[i][j][0] = a * costheta * sinphi;
mesh[i][j][1] = b * sintheta * sinphi;
mesh[i][j][2] = c * cosphi;
}
// Display ()
for(int i=0; i < NVERTICES - 1; i++)
{
glBegin(GL_TRIANGLE_STRIP);
for(int j=0; j < NVERTICES; j++)
{
glVertex3dv(mesh[i][j]);
glVertex3dv(mesh[i + 1][j]);
}
glEnd();
}