I'm trying to create a cubic Bezier curve in 3D. (x, y, z)
First, I made a grid floor using the following code:
// Draw a white grid "floor"
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINES);
float sizefloor = sqrtf(MatrizM);
for (GLfloat i = 0.0; i <= sizefloor; i += 0.25)
{
glVertex3f(i, 0, sizefloor);
glVertex3f(i, 0, 0.0);
glVertex3f(sizefloor, 0, i);
glVertex3f(0.0, 0, i);
}
glEnd();
see the grid floor:

I'm trying to create a curve that leave the point (x=0.5,y=0,z=0) , and arrive at the point (x=2.5, y=0, z=0)
I did as follows:

GLfloat ctrlpoints[4][4][3] = {
{{0.5, 0.0, 0.0}, {0.5, 0.5, 0.0}, //row 1 column 1
{2.5, 0.5, 0.0}, {2.5, 0.0, 0.0}} //row 1 column 6
};
//init..
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlpoints[0][0][0]);
glEnable(GL_MAP2_VERTEX_3);
glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);
//function render...
glColor3f(1.0, 1.0, 1.0);
glPushMatrix();
glBegin(GL_LINE_STRIP);
for (int i = 0; i <= 30; i++) {
glEvalCoord2f((GLfloat)i/30.0, (GLfloat)1/5.0);
}
glEnd();
glPopMatrix();
but it is not getting the right spot, as I define the array {2.5, 0.0, 0.0}
and does not come from the point set {0.5, 0.0, 0.0}
What am I doing wrong?
I did some testing, I saw that maybe I'm missing function glEvalCoord2f, but I'm not sure



















