bit of preparation for porting cone and cylinder: yes, both can be done
authorDiederick Niehorster <dcnieho@gmail.com>
Sun, 25 Mar 2012 14:53:41 +0000 (14:53 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Sun, 25 Mar 2012 14:53:41 +0000 (14:53 +0000)
with triangle strips (and then special treatment of cone tip isn't
needed)

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1212 7f0cb862-5218-0410-a997-914c9d46530a

src/fg_geometry.c

index 438d447..a40ec7b 100644 (file)
@@ -1031,11 +1031,10 @@ void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint s
 
     glEnd();
 
-    /* Cover each stack with a quad strip, except the top stack */
-
-    for( i=0; i<stacks-1; i++ )
+    /* Cover each stack with a triangle strip */
+    for( i=0; i<stacks; i++ )
     {
-        glBegin(GL_QUAD_STRIP);
+        glBegin(GL_TRIANGLE_STRIP);
 
             for(j=0; j<=slices; j++)
             {
@@ -1050,22 +1049,6 @@ void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint s
         glEnd();
     }
 
-    /* The top stack is covered with individual triangles */
-
-    glBegin(GL_TRIANGLES);
-
-        glNormal3f(cost[0]*sinn, sint[0]*sinn, cosn);
-
-        for (j=0; j<slices; j++)
-        {
-            glVertex3f(cost[j+0]*r0,   sint[j+0]*r0,            z0    );
-            glVertex3f(0,              0,              (GLfloat)height);
-            glNormal3f(cost[j+1]*sinn, sint[j+1]*sinn,          cosn  );
-            glVertex3f(cost[j+1]*r0,   sint[j+1]*r0,            z0    );
-        }
-
-    glEnd();
-
     /* Release sin and cos tables */
 
     free(sint);
@@ -1186,7 +1169,7 @@ void FGAPIENTRY glutSolidCylinder(double radius, double height, GLint slices, GL
         if (i==stacks)
             z1 = (GLfloat)height;
 
-        glBegin(GL_QUAD_STRIP);
+        glBegin(GL_TRIANGLE_STRIP);
             for (j=0; j<=slices; j++ )
             {
                 glNormal3f(cost[j],      sint[j],      0  );