View Full Version : GL_LINE Vs. DDA algorithm

mahsa_shk

02-12-2012, 01:50 PM

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

Alfonse Reinheart

02-12-2012, 04:28 PM

What is "DDA algorithm"?

mhagain

02-12-2012, 04:35 PM

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.)

Dark Photon

02-12-2012, 04:45 PM

What is "DDA algorithm"?

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. Wikipedia entry: Digital differential analyzer (graphics algorithm) (https://en.wikipedia.org/wiki/Digital_differential_analyzer_%28graphics_algorith m%29) Related wikipedia entry: Bresenham's line algorithm (https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm)

"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)."

mahsa_shk

02-13-2012, 01:39 AM

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

Good Luck

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.