-
- glColor3f(1,1,1);
- glBegin( wire ? GL_LINE_LOOP : GL_QUADS );
-
- t = 0.0;
- for(i=0; i<stacks; i++) {
- rho = i * drho;
- s = 0.0;
- for(j=0; j<slices; j++) {
- theta = j * dtheta;
-
-
- glTexCoord2f(s,t);
- ParametricSphere(theta, rho, vector);
- normalize(vector);
- glNormal3fv(vector);
- ParametricSphere(theta, rho, vector);
- glVertex3f( vector[0]*radius, vector[1]*radius, vector[2]*radius );
-
- glTexCoord2f(s,t+dt);
- ParametricSphere(theta, rho+drho, vector);
- normalize(vector);
- glNormal3fv(vector);
- ParametricSphere(theta, rho+drho, vector);
- glVertex3f( vector[0]*radius, vector[1]*radius, vector[2]*radius );
-
- glTexCoord2f(s+ds,t+dt);
- ParametricSphere(theta + dtheta, rho+drho, vector);
- normalize(vector);
- glNormal3fv(vector);
- ParametricSphere(theta + dtheta, rho+drho, vector);
- glVertex3f( vector[0]*radius, vector[1]*radius, vector[2]*radius );
-
- glTexCoord2f(s+ds, t);
- ParametricSphere(theta + dtheta, rho, vector);
- normalize(vector);
- glNormal3fv(vector);
- ParametricSphere(theta + dtheta, rho, vector);
- glVertex3f( vector[0]*radius, vector[1]*radius, vector[2]*radius );
-
- s = s + ds;
-
- }
- t = t + dt;
- }
- glEnd();