GLfloat *sphereColors, *sphereNormals, *sphereVertices; GLuint *sphereIndices; int count; // from last class... GLuint CreateSphereDisplayList( void ) { GLuint sphereListID = glGenLists(1); glNewList( sphereListID, GL_COMPILE ); CreateSphere( 1.0, 10 ); glEndList( ); return sphereListID; } // Creates and populates a vertex array containing a sphere // (Note this is NOT the most efficient vertex array, since // duplicated vertices are duplicated, rather than storing // once and repeatedly indexing the same array!) void CreateSphereArray(double r,int n) { int i,j; double theta1,theta2,theta3; double e[3],p[3]; int arrayIndex = 0; if (r < 0) return; if (n < 4) return; sphereColors = (GLfloat *)malloc( 4 * ((n/2) * (n+1) * 2) * sizeof(GLfloat) ); sphereNormals = (GLfloat *)malloc( 3 * ((n/2) * (n+1) * 2) * sizeof(GLfloat) ); sphereVertices = (GLfloat *)malloc( 3 * ((n/2) * (n+1) * 2) * sizeof(GLfloat) ); for (j=0;j