Loading Control Points


I have been looking into bezier curves and all the tutorials I find have the control points already allocated at the top of the program. I was wondering, how could I load these from a file?


Some lessons of NeHe have used from a function to load the data from a text file. See lesson 10 or 25 of NeHe. you write your control points into the text file and then read the values of the text file.

I am able to load the points now, but I cannot load them into mp Bezier map, the code says that the last parameter of glMap2f to a float or integer, it has to be a const.

void glMap2f(GLenum target,
             GLdouble u1,
             GLdouble u2,
             GLint ustride,
             GLint uorder,
             GLdouble v1,
             GLdouble v2,
             GLint vstride,
             GLint vorder,
             const GLfloat *points)

If I am not mistaken the last parameter must just be an array of (or pointer to) GLfloat, the const meaning that glMap2f itself won’t modify the data.

So don’t worry.