Reputation: 2127
I've been curious about GL_LINES (and GL_LINE_LOOP and STRIP) for some time, and i'm wondering how the GL implementations typically handle them. Do they extrapolate a quad from the endpoints and width of the line? Does it do something more primitive and specialized?
I know it's implementation specific, but given a generic nVidia or ATI driver and windows hardware, what could i expect GL to be doing to generate those fine upstanding lines?
Upvotes: 3
Views: 367
Reputation: 162297
Usually lines are rasterized directly using some variant of Bresenham's algorithm, which is much faster (and easier to implement) than a scanline, primitive filling rasterizer. Modifications of Bresenham's allow for thick, antialiased lines.
Technically the challenge lies in determining which fragments in the buffer are covered by a primitive. This happens by fixed wired hardware, after the tesselation, geometry and vertex shaders, but before the fragment shader.
Upvotes: 5