Extending lines

Here’s my dilemma - I have a bunch of line segments that form a smooth contour. I cannot guarantee the drawing order of the segments, so I must draw them each end-to-end individually. I am ending up with 1 pixel gaps between many of the segments, probably due to slight floating point imprecisions in the calculations for the points. Is there a facility in OpenGL to automatically extend the length of the lines by a pixel on either end, or something that will have the same effect?

Obviously, I could do this manually, but I thought that perhaps GL would have something that might be faster…


garantee the order and use GL_LINE_STRIP

I had this problem and it is not really due to floating point imprecisions. It is the way the fragments get calculated. A fragment has to at least cover 50% of a pixel to get drawn as I believe. So you need to make your lines a little bit longer than they actually are. to guarantee that the first fragment and the last take up the pixel.