PDA

View Full Version : Draw path



VictorS
11-05-2004, 06:44 AM
Hello
I'm try draw path composed of lines and curves Bezier and then I'm want fill it. But below code not work correctly :( because call glMap1f function within glBegin..glEnd not work.
How I can draw such polygon?

glBegin(GL_POLYGON)
glVertex2f(0, 0)
glVertex2f(100, 0)
glVertex2f(100, 100)

//then I'm want draw curve like this:
GLfloat ctrlpoints[4][3] = {
{100, 100, 0}, { 70, 150, 0.0}, { 30, 130, 0},
{ 0, 0, 0 }};

glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]);
glEnable(GL_MAP1_VERTEX_3);

for (int i = 0; i <= 30; i++) {
glEvalCoord1f((GLfloat)i / 30);
}

glEnd();