fun colored line ?

Hi,

I would like to create a line with a degrade effect: for exemple, I want the first point in blue and the second in red and between a degrade of colors between red and blue…Somebody can show me how make ? thanks.

Try assigning a color to each vertex of the line. OpenGL should produce automatically a gradient.

glBegin(GL_LINES);

glColor(1,0,0);

glvertex3f(x1,y1,z1);

glColor(0,0,1);

glvertex3f(x2,y2,z2);

glEnd();

Originally posted by frog:
[b]Hi,

I would like to create a line with a degrade effect: for exemple, I want the first point in blue and the second in red and between a degrade of colors between red and blue…Somebody can show me how make ? thanks.[/b]

Its very simple:
glBegin (GL_LINES);
glColor3f(0.0f,0.0f,1.0f); //blue
glVertex3f(1.0f,1.0f,0.0f); //1 point
glColor3f(1.0f,0.0f,0.0f); //red
glVertex3f(1.0f,0.0f,0.0f); //2 point
glEnd();

You MUST activate:
glEnable(GL_SMOOTH);
before drawing

Originally posted by frog:
[b]Hi,

I would like to create a line with a degrade effect: for exemple, I want the first point in blue and the second in red and between a degrade of colors between red and blue…Somebody can show me how make ? thanks.[/b]

Its very simple:
glBegin (GL_LINES);
glColor3f(0.0f,0.0f,1.0f); //blue
glVertex3f(1.0f,1.0f,0.0f); //1 point
glColor3f(1.0f,0.0f,0.0f); //red
glVertex3f(1.0f,0.0f,0.0f); //2 point
glEnd();

You MUST activate:
glEnable(GL_SMOOTH);
before drawing