i have a list of points that represent joins for line segments. one can think of bones, maybe. i want to build tubes (triangle meshes) from this lines with a given tube segment count. the reason for that is, that i want to render real lines in opengl, with lighting, shadows and so on. glLineWidth is not what i'm looking for.

the problem i have are the shared tube points on the joins. what i have tried is the following:

1. interpolate the direction of the next and the previous line segment on a given join

2. build x quaternions with that given axis and the angle = DEG2RAD(x*360/tube_segment_count);

2.1 convert each quaternion into a matrix

2.2 using the 2nd column (up vector) of that matrix, scale it by the tube radius, add the join position and store that vector

3. connect all calculated vectors by triangles

so far, no problem. but when i build a simple circle with maybe 10 joins, some tube segments get twisted. i know, why this problem occurs, but i dont know of a robust solution to this problem.

regards,

jan