PDA

View Full Version : Algorithm implemented for drawing line in OpenGL



Bhupendra
02-01-2016, 03:09 AM
Do someone know, which is the algorithm implemented by OpenGL for drawing a line?
- Bresenham or any other??

mhagain
02-01-2016, 04:15 AM
Section 14.5.1 of the GL specification (I'm using 4.4 here) defines the line-drawing rules for OpenGL. This section firstly describes the ideal case, which it notes is a modified Bresenham, but also notes the following:
Because the initial and final conditions of the diamond-exit rule may be difficult to implement, other line segment rasterization algorithms are allowed...
There is therefore no specific algorithm implemented by OpenGL for lines. This should be obvious because OpenGL is not a software library, it's implemented in drivers by GPU vendors, and the line drawing method used is implementation-dependent.