CS 488/688: Introduction to Computer Graphics

Fall 2016 Assignment 0: Warmup


The goal of this assignment is to get you accustomed to the websites, tools and technology that we will use throughout the term. There will be a small amount of coding, but you will not need to write any OpenGL code yourself—those parts of the assignment will be provided for you.

This assignment is optional. If you do not hand it in, you will not lose marks. If you do hand it in, it will be marked in the normal way, but the mark will not count towards your final grade. The problem is that it's all too easy to lose marks on future assignments for silly reasons that have nothing to do with understanding the material (such as misunderstanding the submission instructions, or failing to include appropriate documentation). Completing Assignment 0 will help you avoid making any such mistakes when it counts. You'll also get some direct experience with the kind of code you'll be writing throughout the term.

Conversely, it's always possible that we've introduced our own errors in the code we're distributing to you this term. Thus, it's helpful to us for you to complete Assignment 0: your feedback will help us iron out any problems before they derail future assignments.

The directions in this assignment are more explicit than in the remaining assignments. In the future, the steps to follow will not be given in so much detail.

Step 0: Course information

Get acquainted with the information associated with this course. Read the main course web page. Read the outline and make sure your responsibilities are clear and that you are familiar with the marking scheme. Download the lecture notes or purchase a paper copy from the university. Read the additional notes regarding assignments before completing this assignment or submitting anything.

Step 1: Piazza

In order to ask questions, help your fellow students, and keep up with timely announcements, you will need to enrol in the Piazza site for this course. You should already have been added at the beginning of the term. Please verify that you are enrolled in the course on Piazza, and enrol yourself if not. You are free to modify the email address you use for your Piazza account according to your personal tastes. On LEARN, submit a text file called piazza.txt that contains the email address you used to enrol online, whether or not it was a uwaterloo.ca address.

Step 2: Framework and source code

By itself, OpenGL doesn't make it possible to write complete programs. At the very least, it needs a way to talk to the computer's window system. And of course, there are numerous libraries, toolkits, and frameworks that we can layer on top of OpenGL to make coding easier. For this course we seek a middle ground: enough infrastructure to help you get started, without hiding the technical details of OpenGL programming. We're using the following:

To avoid potential problems with missing libraries or incorrect versions, you will download a package from us that contains the source code for all these libraries, bundled with skeleton code for the Assignments.

To begin, download the file cs488-f2016.zip and unzip it to create a cs488/ directory. The bundled libraries are all in shared/. You shouldn't need to change anything in that directory. The assignments can be completed by writing code in the A0/, A1/... directories.

Now build the bundled libraries. They have different build processes, but we've provided a quick way to get it all done at once:

  $ cd cs488
  cs488$ premake4 gmake
  cs488$ make

(You'll need to have premake4 and cmake installed on your system.)

Step 3: My First Triangle

Now go into the A0/ directory, build the skeleton code, and run it:

  $ cd A0
  cs488$ premake4 gmake
  cs488$ make
  cs488$ ./A0

You'll see a window with a single white triangle and a small palette in the corner with user interface controls.

Make the following changes to the program, all in A0.cpp:

  1. Initially, the Quit Application button is placed underneath the Red Channel slider. Move it so that it's the first control in the Shape Properties palette. Also, add a keyboard shortcut: the Q key should quit the program.
  2. Add two new sliders to Shape Properties: a Green Channel and a Blue Channel. Taken together, the three sliders should give you complete control over the RGB colour of the triangle.
  3. Add a slider to control the rotation angle of the triangle (there's already a rotation member variable in the A0 class that you can set). The slider should allow you to rotate the triangle through exactly one complete circle.
  4. Add keyboard shortcuts to scale the triangle (again, use the defined member variable). Use the - (minus) key to scale down by a constant factor, and the + (plus) key to scale up by the same factor. Choose your factor so that the triangle scales at a reasonable rate.
  5. Between the Quit button and the sliders, add a Reset button that sets the triangle back into its original state (colour, scale, rotation, position). Add a keyboard shortcut, so that the R key resets.
  6. Take a screenshot of your finished program and store it as A0/screenshot.png.

Step 4: README

For programming assignments, you will be required to create a text file called README. Place your README file in the A0/ directory. The README file should contain two sections:

Step 5: Submitting your program

In most assignments, you'll need to upload a directory of code. Create a ZIP file containing the A0/ directory and all its contents. Upload it to LEARN. If you want to be helpful, do a make clean in A0/ before zipping it up, to avoid including unneeded build files.

You are not required to work on the lab machines to complete assignments, but your code must compile and run cleanly on the lab machines. It is your responsibility to ensure that this is the case! Please try your code at least once on a lab machine before submitting it. You will lose marks if we cannot compile and run it right out of the box.

Step 5: Objective list

Every assignment includes a list of objectives. Your mark in the assignment will be based primarily on the achievement of these objectives, with possible deductions outside the list if necessary.

Assignment 0 objectives