title: OpenGL: Trying to create a solid cylinder using triangle_fan
body: <p>I am trying to create a solid cylinder using triangle fan.
  What I've done so far is this:</p>
  
  <pre><code>float base = 0.5;
  float height = 20;
  float radius = 2.0f;
  glBegin(GL_TRIANGLE_FAN);
  for(float j=0; j&lt;=height; j+=0.1)
  {
      glVertex3f(0,j,0);
      for(int i=0; i&lt;360; i++)
      {
          glVertex3f(radius*sin((float)i),j, radius*cos((float)i));
      }   
  }
  glEnd();
  glPopMatrix();
  </code></pre>
  
  <p>The problem appears in these 3 screenshots:</p>
  
  <p><img src="https://i.stack.imgur.com/lc31z.png" alt="enter image description here"><br>
  As you see in all 3 screenshots there appears to be some space and not a solid cylinder.<br>
  Is that ok? </p>