PDA

View Full Version : Drawing smoothly connected lines with width



esapir
03-21-2014, 05:29 AM
I am trying to draw lines that should be and look connected. The problem is that when the width is not 1.0, the edges don't really look connected.
Is there a way to fix it without drawing the lines with triangles?

1243

Carmine
03-21-2014, 11:59 AM
I am trying to draw lines that should be and look connected. The problem is that when the width is not 1.0, the edges don't really look connected.
Is there a way to fix it without drawing the lines with triangles?

Put anti-aliased (i.e. round) points at the intersection of the lines. Use glEnable (GL_POINT_SMOOTH) to do this. Make the points the ~same width as the lines. This is very easy since you already have the coordinates of the beginning and end of each line segment. No calculations necessary. This will give you nicely rounded corners where your lines meet. Maybe that's not what you want? It has worked well for me. Good luck.

tonyo_au
03-21-2014, 07:03 PM
Note Carmine's technique does not work if you draw with alpha blending - then you have to pre-calculate the edge extrusions which gets ugly in 3D but not to bad in 2D