I really recommend to read this thread :
https://forum.libcinder.org/topic/smooth-thick-lines-using-geometry-shader#23286000001269127This helped me a lot. To implement this I used a class that inherit from
Drawable and has
TrianglesStrip as PrimitiveType (as Laurent suggested).
I copy paste summary of the thread here, in case it would disappear :
The line always starts with a segment :
The line is defined by :
Vector2f line = p1 - p0;
Vector2f normal = Vector2f( -line.y, line.x).normalized();
The boundaries of the segment can be found this way :
Vector2f a = p0 - thickness * normal;
Vector2f b = p0 + thickness * normal;
Vector2f c = p1 - thickness * normal;
Vector2f d = p1 + thickness * normal;
Two joined segments :
The goal is to find m and -m :
Vector2f tangent = ((p2-p1).normalized() + (p1-p0).normalized()).normalized();
Vector2f miter = Vector2f( -tangent.y, tangent.x ); //normal of the tangent
The length of the miter can be found by projecting it on one of the normals, using the dot product :
float length = thickness / miter.dot( normal )
Then, the miter points can be found by :
Vector2f m1 = p1 - length * miter;
Vector2f m2 = p1 + length * miter;