Can i blend a line?
All i want to do is this (mockup):
The trick is, i want to do it with a GL_LINE, not a quad. Lines don''t seem to blend like a quad does however. With quads and triangles and such, if i specify colors of the vertexes, the colors spread into each other across the polygon. What i would *like* to do is specify a line made of two points and two colors and get a gradient.
Can this be done or does it just not work this way?
If it cannot be done is there a decent way to fake it? The only thing i can think of is to A) use a quad instead, or B) use a line strip with many segments to make it look like a gradient.
well... You can,
glBegin(GL_LINES);
glColor3f(1,0,0);glVertex3f(-1,0,0);
glColor3f(0,1,0);glVertex3f(1,0,0);
glEnd();
that will draw a line with a smooth gradient.
"I seek knowledge and to help those who also seek it"
glBegin(GL_LINES);
glColor3f(1,0,0);glVertex3f(-1,0,0);
glColor3f(0,1,0);glVertex3f(1,0,0);
glEnd();
that will draw a line with a smooth gradient.
"I seek knowledge and to help those who also seek it"
That does not work (at least not on my system). I have blending enabled and a function for blending, i even have the line smoothing and smoothing hint turned on. Still won''t work. I just get a solid green bar with your code.
Try glShadeMode(GL_SMOOTH), disable blending as you don''t need it, the colors are interpolated anyway.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement