Description
This lab will introduce you the basic problem of rasterization.
For this lab you will implement the Midpoint (MPA) line rasterization algorithm in OpenGL.
Your implementation should be able to draw multiple lines of any slope without breaks.
Instructions
- Complete the Part I in the worksheet
- Download the starter code, compile, and run. - draws a circle and a crossmark initially -
- Play with the controls and compare with DDA
- Follow the instructions in Part II in the worksheet, to implement the Midpoint algorithm.
- Once your algorithm works perfectly, run some tests and fill the table at the end of your worksheet.
- Demonstrate the code and the table to your TA.
Worksheet
A printed copy of the worksheet will be provided at the beginning of the lab session.
You can download the electronic version here.
Code
You may download the starter code from here.
- Compile: make
- Run: ./rasterize_line
- Controls:
- c: Clear old lines.
- a: Generate 1K random lines.
- A: Generate 1M random lines.
- m: Toggle between the MPA and the DDA algorithms.
- ]: Increase point size.
- [: Decrease point size.
External Resources
Midpoint algorithm Wiki entry
DDA Wiki entry