Computer Graphics (50:198:456/56:198:556)
Fall 2017

Instructor: Suneeta Ramaswami

Office: 323 Business and Science Building
Telephone: (856) 225-6439
Fax: (856) 225-6624

Programming Assignment #1: 2D drawing and event processing
Due: 9/28/17 (by 11:55pm)

Problem Description: Canvas Write a program that simulates a 2D canvas and draws various 2D shapes.

The program draws in the following mode:

In addition, your program should accept the following commands:

Demo: An executable hw1-mac is available under Resources on Sakai, which will run on Mac OS X. (If you don't have a Mac, you can run this on the Macs in the student lab in Robeson Library.) Run it to get an idea of how the program behaves.

Additional requirements/hints

  1. Display a rubberband (dotted moving line following the mouse point) when mouse button is held down during appropriate time of drawing.
  2. Use a linked list to keep track of all your shapes. If using C, use a generic linked list with void*, if using C++, make sure you set up the classes right for STL list. Do not use arrays.
  3. Keep track of all shapes, and be careful to draw the shapes from back to front to show correct overlapping, i.e. oldest shapes should be drawn first.
  4. When clearing, you should make sure that you clean up memory also. That is, delete all current shapes and avoid any memory leaks!
  5. Circles are not part of the GL basic primitives. You can draw circles by dividing a circle into a certain number of slices (triangles), i.e. use GL_TRIANGLE_FAN.
  6. If you are using multiple files, please provide a Makefile.

What to turn in:

Upload the final version of your program on Sakai by 11:55pm on September 28, 2017.