Setting up Cygwin

The projects can be compiled and run under Windows by using cygwin. The first step is to set this up.

  1. Install cygwin. Download and run the installer setup-x86_64.exe. I will call this the setup program. Keep this executable in a convenient place. You will use this executable to install cygwin and also to install packages within cygwin.
  2. Run the setup program. Mostly you just click through the panes. You will need to select a server; I just used the first one. You will also be presented with a pane that lists many programs, version numbers, etc. in a table. This is the pane where you select packages to install; I will call this the install pane. For now, just click through and finish the install. Let the program create an icon somewhere.
  3. Run the icon that it created. I will call this program the terminal. When you run it, you get a command prompt. This is a bash prompt. It accepts linux commands (ls, cd, cat, echo, pwd, ...).
  4. Run the setup program again. Click through to the install pane where all the programs were listed before. Change "Pending" to "Full" at the top left of the window. You can mark a package for installation by using the search box to search for the name of the package. Clicking on "Skip" next to a package will change this entry to something else; a version string means that that version of the program will be installed (I used the highest-numbered versions). Once you have clicked this, the package is marked for installation. You can now continue with the next package. When you have marked all of the packages that you want, continue on to the next pane and finish the install; this will download and install all of the packages you have selected. The packages that we will need are: When you have selected the latest versions of each of these for installation, finish the install. When you do this, it will automatically select additional dependencies for installation for you.

Setting up Project

At this stage, you should have a Cygwin install with all of the necessary programs and libraries. Next, it is time to set up the project and make it compile and run.

  1. Run the terminal. Execute the command "pwd" to see where you are at. The string that is printed will look something like this: /cygdrive/c/something/goes/here This corresponds to the Windows path C:\something\goes\here. If you want D:\foo\bar.txt then in cygwin you would use /cygdrive/d/foo/bar.txt and so on. What we want to know at this point is where the "pwd" is pointing us. Lets call this the default location.
  2. Download the project file (called proj-rt-files.tar.gz for the first project) and place it in the default location.
  3. Run the terminal again. Use "tar xfz proj-rt-files.tar.gz" to extract the project files.
  4. Open up the file called SConstruct in a text editor (you can use notepad or something). Change "libpng12" to "libpng16" and save it.
  5. In the terminal, go to the proj-rt-files directory. You should see lots of files. Run "./grading-script.py ." and see what is printed. You should see some compilation commands at the top (no errors or warnings), a bunch of "TODO" and "diff: " lines, and a summary at the end "FINAL SCORE: 0"

Workflow

The workflow now looks like this:

  1. Edit the files (sphere.cpp, box.cpp, etc.) wherever you like. (Visual Studio, notepad, etc.) Don't compile them in Visual Studio, though.
  2. From the cygwin terminal, you can run "scons" within the project directory to build everything. You can run "./grading-script.py ." to check you score. You can run the program on a single file as "./ray_tracer -i 00.txt" or do a difference check with "./ray_tracer -i 00.txt -s 00.png"
  3. View the output image however you like. (Eg, double click it from explorer). The output is output.png. If you did a difference check, you will get a difference in diff.png.