   Sphere 2 mouth
  So I got this opengl code to build a simple sphere:void RenderSolidSphere(double radius, int slices, int stacks){/* Adjust z and radius as stacks are drawn. */   double z0 = 0.0, z1 = 0.0, r0 = 0.0, r1 = 0.0;/* Pre-computed circle. */   double* sint1 = NULL, * cost1 = NULL;   double* sint2 = NULL, * cost2 = NULL;   CircleTable(&sint1, &cost1, -slices);   CircleTable(&sint2, &cost2, stacks * 2);/* The top stack is covered with a triangle fan. */   z0 = 1.0;   z1 = cost2[1];   r0 = 0.0;   r1 = sint2[1];   glBegin(GL_TRIANGLE_FAN);   glVertex3d(0.0, 0.0, radius);   for (int j = slices; j >= 0; --j)   { glNormal3d(cost1[j] * r1, sint1[j] * r1, z1); glVertex3d(cost1[j] * r1 * radius, sint1[j] * r1 * radius, z1 * radius);   }   glEnd();/* Cover each stack with a quad strip, except the top and bottom stacks. */   for (int i = 1; i < stacks - 1; ++i)   { z0 = z1; z1 = cost2; r0 = r1; r1 = sint2; glBegin(GL_QUAD_STRIP); <span class="cpp-keyword">for</span>(<span class="cpp-keyword">int</span> j = <span class="cpp-number">0</span>; j &lt;= slices; ++j) {    glNormal3d(cost1[j] * r1, sint1[j] * r1, z1);    glVertex3d(cost1[j] * r1 * radius, sint1[j] * r1 * radius, z1 * radius);    glNormal3d(cost1[j] * r0, sint1[j] * r0, z0);    glVertex3d(cost1[j] * r0 * radius, sint1[j] * r0 * radius, z0 * radius); } glEnd();   }<span class="cpp-comment">/* The bottom stack is covered with a triangle fan. */</span>   z0 = z1;   r0 = r1;   glBegin(GL_TRIANGLE_FAN);   glVertex3d(<span class="cpp-number">0</span>.<span class="cpp-number">0</span>, <span class="cpp-number">0</span>.<span class="cpp-number">0</span>, -radius);   <span class="cpp-keyword">for</span> (<span class="cpp-keyword">int</span> j = <span class="cpp-number">0</span>; j &lt;= slices; ++j)   { glNormal3d(cost1[j] * r0, sint1[j] * r0, z0); glVertex3d(cost1[j] * r0 * radius, sint1[j] * r0 * radius, z0 * radius);   }   glEnd();<span class="cpp-comment">/* Release sin and cos tables. */</span>   free(sint1);   free(cost1);   free(sint2);   free(cost2);   <span class="cpp-keyword">return</span>;}</pre></div><!–ENDSCRIPT–>And I was using it to render a simple 3D yellow "Pac Man". Now with the game logic complete, I was looking to improve the graphics.Is it possible to "cut out" a wedge from the sphere, thus forming pac man's mouth??? If so, how would I go about this? Example code?Thanks in advance…
  Either model a mesh in a 3d package (you are going to want to do that if you want to model the eyes or to put legs on pacman or whatever anway)If you are going to really just make him a sphere with a wedge cutout and use texture maps only for the eyes, then you should be able to pretty easily run the sphere code and then simply alter the existing shape after making it. Try altering your rendering code to put the verticies into a buffer. Also, remove the sin/cos table making, it's really not needed on modern CPUs and you will make a HUGE performance increase by caching the results of the actually sphere generation rather than the trig functions. Then simply modify the verticies of the mouth by scaling them about the center of the sphere.   ;  Of course I am using an opengl list!!! And little little little spheres for the eyes!   list[4] = list[0] + 4;   glNewList(list[4], GL_COMPILE); RenderSolidSphere(0.2, 16, 16);   glEndList();I just want to cut out a wedge for the mouth.   ;  dont draw all the slices (perhaps segments is a better term as in cheese segments)   ;  the library of glut or aux has some function to slice sphere, if I remember correctly. You should look into the info.   