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.
Well, just loop from 0 to 10 and divide by 10.
OpenGL only knows planar primitives. Curves lie beyond it’s grasp. What evaluators do is, they allow you to tell OpenGL coefficients of interpolating function, then you tell OpenGL to sample the function for the parameters given.
Technically OpenGL evaluators are outdated technology. Neither are they HW accelerated, nor do the make driver development simpler. They got removed from OpenGL-3 core, for the simple reason, that you can implement evaluator like functionality using a vertex shader, which is then accelerated by the GPU, and you can put tesselators on them to generate the sampling points on the GPU as well.