title: Rendering B-Spline Curves in OpenGL
body: <p>I've been working on an OpenGL project that's essentially practice for drawing b-spline curves. My program returns no errors but the curves won't display.</p>
  
  <p>Given an array of control points of length 13 named 'coords' (the control points themselves are all visible on-screen), this is my code:</p>
  
  <pre><code>glBegin(GL_LINE_STRIP);
  
  float x=0;
  float y=0;
  float z=0;
  for (double u = 3; u &lt;= 14; u+=0.1){
  
      for (int i = 1; i &lt;=13; i++){
          x += NofU(u,i)*coords[i].x;
          y += NofU(u,i)*coords[i].y;
          z += NofU(u,i)*coords[i].z;
      }//for
  
  }//for
  
  glVertex3f(x, y, z);
  
  glEnd();
  </code></pre>
  
  <p>Where "NofU" represents the blending functions:</p>
  
  <pre><code>double NofU(double u, int i){
  
  if (u &lt; i)
      return 0;
  else if (u &lt; i+1)
      return (1/6)*pow(u,3);
  else if (u &lt; i+2)
      return (1/6)*((-3)*pow(u,3)+3*pow(u,2)+3*u+1);
  else if (u &lt; i+3)
      return (1/6)*(3*pow(u,3)-6*pow(u,2)+4);
  else if (u &lt; i+4)
      return (1/6)*pow((1-u),3);
  else
      return 0;
  
  }//NofU
  </code></pre>
  
  <p>When I attempt print statements, I end up with either insanely large or small coordinate values, or just 0.</p>