CS 488/688: Introduction to Computer Graphics

Assignment 0: Warmup


Summary

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 assignment is for you to help avoiding losing marks on future assignments for 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 other assignments, 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 course web page and make sure your responsibilities are clear and that you are familiar with the marking scheme. Read the additional notes regarding assignments before completing this assignment or submitting anything.

Step 1: MS Team

In order to ask questions, help your fellow students, and keep up with timely announcements, you will need to enroll in the MS Team group for this course. You should already have been added at the beginning of the term. Please verify that you are enrolled, or let us know immediately.

Optinal step: Install Virtual Machine

If you have Linux installed on your machine, you may skip this step. However, it would still be useful for you to verify that your code runs fine on our side before you submit it.

If you don't have Linux installed on your machine, you may use a Virtual Machine to write your assignments. If you wish to use a virtual machine, you should perform the following steps:

  1. Download VirtualBox. Choose the appropriate platform package for your host OS.
  2. Download the cs488 virtual machine
  3. Extract the contents of cs488-VM.zip
  4. Open VirtualBox.
  5. Click Add
  6. Select the "cs488.vbox" file that was extracted in step 3)
  7. Click start
  8. Log in with the password "graphics"
For students familiar with virtual machines, note that the VM comes with "guest additions" installed. The VM also comes with the necessary packages to build and run the CS 488 assignments, so the next step is to download and build A0 following the procedure outlined in Step 2.

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. 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. Download the file 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.

Currently, our premake4 files specify that the code will be compiled with C++14. If you prefer to use c++17, then edit premake4.lua and change "-std=c++14" to "-std=c++17" in the build options. You will need to do this in the cs488/ directory as well as the assignment directories (e.g., A0/, A1/, etc.). Contact the instructor if you wish to use another C++ standard other than 14 or 17.

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:

You should also note in your manual any objectives that you did not complete. If you wrote code for objectives that you did not get completed, you may request code credit in your manual.

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.

The proper way to create the A0.zip is to use the -r option. By default, the zip is not recursive. For example:

$ cd cs488
cs488$ zip -r A0 A0
	
This will create a file called A0.zip in the cs488 folder. If you forgot the -r option, then the A0 folder in the zip file will be empty and you will receive a poor grade for Assignment 0.

We highly recommend that after submitting, you download your own A0.zip file, unzip it and and execute premake4 gmake and make again to make sure that everything compiles and builds as expected. For example, a left-over temp file named A0-backup.cpp will likely cause your submission to not build. Also be sure to test that your submitted A0 executes correctly and matches your expectations.

Your code must compile and run cleanly on the provided VirtualBox environment. It is your responsibility to ensure that this is the case! You will lose marks if we cannot compile and run it right out of the box.

Take special care as your home machine may have a newer compiler. As such, code written at home may not compile on our side, especially if you make use of language features.

Also, be sure to print, sign, and include a signed copy of a0declare.pdf, which you'll find in the provided files. YOUR ASSIGNMENT WILL NOT BE MARKED AND YOU WILL RECEIVE A 0 FOR THIS ASSIGNMENT IF A SIGNED COPY OF a0declare.pdf IS NOT SUBMITTED. A similar declaration must be submitted for each assignment as well as your project.

Step 6: 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