Anuja-19 / Snippets

7 stars 88 forks source link

OpenGL DDA algorithm #171

Closed sofia100 closed 3 years ago

sofia100 commented 3 years ago

How to draw a line in Graphics code OpenGL using Python? The DDALine() takes the coordinates of the starting point (x1, y1) and the ending point (x2, y2) as the input and fines the slope of the required line. Depending on the slope we take unit distance in X or Y axis and calculate from the slope its respective distance in Y or Xaxis. For every coordinate that we calculated, the pixel glows and thus gives a straight line.