2019 January 5,

CS 311: Installation

Our course requires several pieces of software. I have chosen this mix of tools because I prefer software that works across operating systems (macOS, Windows, Linux, etc.). In practice that ideal is difficult to achieve.

All of this software is installed under macOS on the lab machines in CMC 306 and CMC 304. If you want to install the software on your own computer, then consult the instructions below. If you need additional help, then ask Mike Tie in CMC 305.

macOS

The macOS operating system comes with OpenGL and time.h preinstalled.

To get a C compiler, download Apple's Xcode developer tools. If you are given the option to install command-line tools, then do so. Installation takes a while. Once it's done, launch Xcode and agree to the licensing terms. Then more installation happens. Then, in Terminal, test your compiler against the files 000helloWorld.c, ..., 000functions.c from our Day 01 homework.

To get GLFW, it's easiest to first get cmake. So, in a web browser, download cmake-3.13.1-Darwin-x86_64.dmg (or a more recent version) from https://cmake.org/download. In the Finder, open the .dmg file and copy CMake.app into into your Applications folder.

Now, install GLFW via the following steps. (I'm told that installing GLFW through Homebrew leads to some kind of failure. Instead, follow the instructions below.)

  1. Download and unarchive the GLFW source code (not a binary package).
  2. In Terminal, cd to the top-level glfw folder.
  3. mkdir build
  4. cd build
  5. /Applications/CMake.app/Contents/bin/cmake .. -DGLFW_USE_RETINA=0 -DBUILD_SHARED_LIBS=1 -DCMAKE_C_FLAGS="-Wno-deprecated"
  6. make
  7. sudo make install
  8. cd /usr/local/
  9. sudo chmod -R a+rX *

The last two steps above may or may not be necessary. Test your GLFW installation against the file 000linking.c from our Day 01 homework. It's possible that you need to compile your own copy of 000pixel.o. I can help you with that.

Finally, to install GL3W, follow these steps:

  1. In a web browser, visit https://github.com/skaslev/gl3w/. Click "Clone or download" and download the ZIP archive. In the Finder, double-click the archive to unarchive it.
  2. In Terminal, sudo mv gl3w-master /usr/local/gl3w
  3. cd /usr/local/gl3w
  4. /Applications/CMake.app/Contents/bin/cmake .
  5. sudo /Applications/Python\ 3.6/Install\ Certificates.command
  6. python3 gl3w_gen.py
  7. cd src
  8. clang -I ../include gl3w.c -c
  9. cd ../include
  10. cp -rp GL /usr/local/include
  11. cp -rp KHR /usr/local/include

Sometime around midterm break, you will be able to test your GL3W installation against 300openGL32.c.

Here's a final word of wisdom from Mike: "If the students try this on their home computers and if /usr/local/include isn't on their include path, then they may need to add -I /usr/local/include when compiling the examples."

Windows

You should be able to do all of this course on Windows, if you are willing to run Linux inside Windows. Mike Tie has crafted instructions. See Carlpedia, the Carleton technical wiki. You may need to sign in with your campus credentials. You will need to compile 000pixel.o specially; talk to me about that.

In theory, we should be able to do all of this course on Windows natively (without going through Linux). For example, many Windows games are written in OpenGL. In practice, it's a bit tricky, because of time.h and compiler discrepancies. So let's not.

Linux

You should be able to do all of this course on Linux. Mike Tie has crafted instructions for Ubuntu Linux; if you use some other distribution, then you'll have to modify the instructions. See Carlpedia, the Carleton technical wiki. You may need to sign in with your campus credentials. You will need to compile 000pixel.o specially; talk to me about that.