Lab 5
Lab 5
Write a program using WebGL to implement digital differential analyzer line drawing algorithm.
Step 1 − The program should accept two points, the starting point (x1, y1) and the ending
point (x2, y2) as an input. To accomplish this, you have to create four input boxes as
shown in the screenshot below.
Step 2 − Create a button with click event. When the user clicks the draw button, the
program will execute a function called drawLine.
Step 3 − The drawLine function should follow the DDA algorithm explained in chapter
4.
Modify the sample program provided (dda.html) so that it can handle the following scenarios:
If m < 1 : If m > 1 : If m = 1 :
xinc = 1 xinc = (1 / m) xinc = 1
yinc = m yinc = 1 yinc = 1
Reference