CSC 333
Homework 1

Assigned Sept 6, due Sept 30

There are two programs to be written, the first one simpler (so do it first).

  1. Write a C or C++ program, using the OpenGL library and programmable shaders, that draws several 2-D polygons of different colors, with at least two vertices shared among more than one polygon.

  2. Write a C or C++ program, using the OpenGL library and programmable shaders, that allows the user to create 2-D polygons by clicking with the mouse to indicate vertex coordinates. (You are not required to handle self-intersecting polygons correctly, although I'll be more impressed if you do.)

    For a first version, just build a single polygon from all of the user's mouse clicks.
    (I did this in 27 lines of Racket; naturally, it'll take a lot more in C++ with OpenGL, but on the other hand OpenGL provides a lot of capabilities that the Racket picturing-programs library doesn't.)

    Once you've got that working, try building multiple polygons: the user should indicate that the current polygon is finished either by double-clicking, or by pressing a specified key on the keyboard, or by clicking “near” the first vertex (your choice which to implement), after which subsequent mouse-clicks go into a separate polygon.
    (This took me 39 lines of Racket.)


Last modified: Thu Sep 5 14:54:10 EDT 2013
Stephen Bloch / sbloch@adelphi.edu