-/* sphere, Copyright (c) 2002 Paul Bourke <pbourke@swin.edu.au>
+/* sphere, Copyright (c) 2002, 2008 Paul Bourke <pbourke@swin.edu.au>
* Utility function to create a unit sphere in GL.
*
* Permission to use, copy, modify, distribute, and sell this software and its
typedef struct { GLfloat x, y, z; } XYZ;
-void
+int
unit_sphere (int stacks, int slices, int wire_p)
{
+ int polys = 0;
int i,j;
double theta1, theta2, theta3;
XYZ e, p;
glBegin (GL_POINTS);
glVertex3f (c.x, c.y, c.z);
glEnd();
- return;
+ return 1;
}
glFrontFace(GL_CW);
2*j / (double)stacks2);
glVertex3f (p.x, p.y, p.z);
if (wire_p) lb = p;
+ polys++;
}
glEnd();
}
+ return polys;
}