Drawing bezier curve with limited subdivisions in OpenGL

Posted by xEnOn on Stack Overflow See other posts from Stack Overflow or by xEnOn
Published on 2011-11-19T09:45:37Z Indexed on 2011/11/19 9:50 UTC
Read the original article Hit count: 279

Filed under:
|

Is it possible to tell OpenGL to draw a 4 degree (5 control points) bezier curve with 10 subdivisions?

I was trying with this:

point ctrlpts[] = {..., ..., ..., ...};
glMap1f(GL_MAP1_VERTEX_3, 0, 1, 3, 5, ctrlpts);
glBegin(GL_LINE_STRIP);
      for (i = 0; i <= 30; i++) 
         glEvalCoord1f((GLfloat) i/30.0);
glEnd();

But this just draws the curve nicely. I am thinking that I want the algorithm inside the bezier curve to draw only until 10 subdivisions and then stop. The line should look a little facet.

© Stack Overflow or respective owner

Related posts about c++

Related posts about opengl