Drawing lines, where are they actually drawn

What is the general rule for predicting how opengl draws lines? If i draw a line from say 0,0 to 0,10 with a thickness of 2 does it get the thickness by drawing a rectangle -1,0 0,10 or does it draw a rectangle 0,0 1,10 (ie is it getting the thickness by drawing left or drawing right). Is this determined by the direction, ie a line in the opposite direction. Is drawn differently?

I’m not even sure it even is standardized. The last time I played around with thicker then 1 pixel lines it drawn a square bar from start to end. So you always hat a deep corner on each angled connection of thick lines.

Just set your thickness to something large (10-20) and you should see how your driver behaves. But I would not relay on it to be the same on all devices.

The other thing to be aware of is that lines with width greater than 1 may not be supported in hardware, so they’re going to be emulated in some manner. The OpenGL spec typically doesn’t care how something like this may be emulated; all that matters is that (1) it behaves as if it were not emulated, and (2) it’s otherwise conformant with the spec.

Rasterisation of lines is covered in §14.5 of the OpenGL 4.6 specification. Briefly:

Non-antialiased wide lines are parallelograms: the result is the same as drawing multiple thin lines offset in the minor direction (i.e. in the y direction if the line is closer to horizontal than vertical, in the x direction if closer to vertical than horizontal). The exact algorithm used for rasterisation is implementation-dependent.

Anti-aliased wide lines are rectangles, with two edges parallel to the line and the other two perpendicular.

Also: note that line strips/loops don’t have joins; there’s no difference between drawing a strip/loop and drawing the individual segments separately.

Thanks all, looks like for consistency I will just use thin quads (2 triangles) so I know where they are drawn