title: How draw Hyperboloids with OpenGL C++?
body: <p>I'm trying to draw quadrics in C ++ with OpenGL.</p>
  
  <p>Quadrics are the Sphere, and <a href="https://en.wikipedia.org/wiki/Hyperboloid" rel="nofollow noreferrer">Hyperboloides</a> of a leaf and two leaves. To draw them I use only the <strong>parametric equations</strong> of each. The sphere if I drew</p>
  
  <p><strong>Example:</strong> The parametric equations of the Sphere are:</p>
  
  <p><a href="https://i.stack.imgur.com/tkmlO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tkmlO.png" alt="Sphere"></a></p>
  
  <p>To draw the sphere with these equations, what I do in OpenGL is simply this for a sphere that is draw on the origin <code>x0</code>, <code>y0</code> and <code>z0</code> equal to zero:</p>
  
  <pre><code>void Sphere(){
      GLfloat x, y, z, alpha, beta; // Storage for coordinates and angles
      GLfloat radius = 1.0f;
      int gradation = 20;
      glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
      for (float alpha = 0.0; alpha &lt; PI; alpha += PI/gradation)
      {
          glBegin(GL_TRIANGLE_STRIP);
          for (beta = 0.0; beta &lt; 2.01*PI; beta += PI/gradation)
          {
              x = radius*cos(beta)*sin(alpha);
              y = radius*sin(beta)*sin(alpha);
              z = radius*cos(alpha);
              glVertex3f(x, y, z);
          }
          glEnd();
      }
      glutSwapBuffers();
  }
  </code></pre>
  
  <p>I the <strong>result</strong> is this (a sphere):</p>
  
  <p><a href="https://i.stack.imgur.com/c0bOmm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c0bOmm.png" alt="enter image description here"></a></p>
  
  <p><strong>Problem:</strong></p>
  
  <p>By applying the same logic to the draw <strong>hyperboloids</strong>, I do not get what I want. The <strong>parametric equations</strong> of the Hyperboloides are as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/sAd0F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sAd0F.png" alt="enter image description here"></a></p>
  
  <p>When attempting to draw the <strong>hyperboloid</strong> of one sheet with the equations shown in the <strong>picture</strong>, this is the result:</p>
  
  <p><a href="https://i.stack.imgur.com/dMVlVm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dMVlVm.png" alt="enter image description here"></a></p>
  
  <p>If anyone knows anything about it, please if you can help me with this. Thank you all.</p>
  
  <p><strong>Note:</strong> I know there are other ways to draw a hyperboloid, but the way I draw them is through its parametric equations.</p>