GL_LINE Vs. DDA algorithm

I do not understand what is the difference between the line that is drawn by glBegin(GL_LINE) and the line which is drawn by DDA algorithm.

and I do not know whether DDA is better than glBegin(GL_LINE) or not.

Thanks for replying me

What is “DDA algorithm”?

OpenGL itself doesn’t specify how a line is drawn, it just specifies that a line is drawn. So it could be using any algorithm, or different algorithms on different implementations, or even different algorithms on the same implementation, depending on combinations of states and/or parameters.

Also - and this is critical - OpenGL will most likely be using your graphics hardware for drawing lines (note that some hardware can’t draw some lines which are required to be supported, in which case the driver will do it in software). It’s (mostly) incorrect to think of anything OpenGL does in terms of comparison to any software algorithm.

(It’s also the case that what’s efficient or better quality in a software approach is not necessarily so with hardware, so many such comparisons are completely invalid to begin with.)

Digital Differential Analyzer.

Blast from the past – remember reading about this back in the 80’s back before modern 3D graphics APIs. Simple fixed-point technique for deciding which pixels get set when drawing a line (or curve) between 2 points on a raster display.[ul][li] Wikipedia entry: Digital differential analyzer (graphics algorithm)[*] Related wikipedia entry: Bresenham’s line algorithm[/li] “The Bresenham algorithm can be interpreted as slightly modified DDA (using 0.5 as error threshold instead of 0, which is required for non-overlapping polygon rasterizing).”[/ul]

Thanks for answering my question. I got my answer. :slight_smile:

Good Luck