Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

leiavoia

Can i blend a line?

This topic is 5216 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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"

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Try glShadeMode(GL_SMOOTH), disable blending as you don''t need it, the colors are interpolated anyway.

Share this post


Link to post
Share on other sites
glShadeMode(GL_SMOOTH) was it. thank! can''t believe i overlooked that. I still need blending for everything else, but you solved the problem.

Share this post


Link to post
Share on other sites
glShadeMode(GL_SMOOTH) i want to know what using for else the color?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!