Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do GL_LINES create triangles or use their own processing?

Tags:

opengl

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?

like image 301
Knetic Avatar asked May 21 '26 23:05

Knetic


1 Answers

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.

like image 153
datenwolf Avatar answered May 24 '26 14:05

datenwolf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!