How to draw a smooth thick polyline?

Greetings:

I am New here, and trying to render a round-capped 2D polyline in 3D space.

I’d tried glEnable(GL_LINES);
& glEnable(GL_LINE_SMOOTH);
then set the line_width and rendered.

Unfortunately, it return a 3D polyline, and there are not any capping between tow segments.

How do I solve the problem? Any help is appreciated. :slight_smile:

OpenGL doesn’t do joins or caps. A “polyline” rendered with GL_LINE_STRIP or GL_LINE_LOOP is no different to rendering the individual line segments separately.

If you want joins or caps, you’ll need to render them yourself.

[QUOTE=GClements;1292416]OpenGL doesn’t do joins or caps. A “polyline” rendered with GL_LINE_STRIP or GL_LINE_LOOP is no different to rendering the individual line segments separately.

If you want joins or caps, you’ll need to render them yourself.[/QUOTE]

Ok, I see.

So, I have to write my own geometry shader, right?

If you want GL_LINE_STRIP to do joins or caps, you’ll need a geometry shader which generates triangles. Alternative approaches include conversion to triangles in the application or drawing points at the vertices with a separate draw call.

I have used the method of drawing points at the vertices (suggested by GClements) to good effect.
You will want to use point and line smoothing for best results.

O.K. I will try.

Thank you very much for explanation :slight_smile:

[QUOTE=Carmine;1292434]I have used the method of drawing points at the vertices (suggested by GClements) to good effect.
You will want to use point and line smoothing for best results.[/QUOTE]

thank you for the suggestions~~:)