files/ucrline.png

Description

This lab will introduce you the basic problem of rasterization. For this lab you will implement the DDA (Digital Differential Analyzer) line rasterization algorithm in OpenGL. Your implementation should be able to draw multiple lines of any slope without breaks.

Background

The code you are given below allows you to draw lines on the screen using your mouse. These lines are rasterized using the equation y=mx+b. What happens when you draw a steep line?

Spend some time familiarizing yourself with the DDA algorithm linked below. You should understand how it solves the problem you saw before moving on. Proceed to implement the DDA algorithm in the proper function in code.

A good first step is to get DDA working for quadrant I (dx and dy both positive). With this completed, you now have to handle all different kinds of slopes. When you are finished, you will be able to demonstrate the ability to draw a well-connected line in any direction.

Code

You may download the starter code from here.

External Resources

DDA Wiki entry