2017 February 17,

CS 311: Technical Issues

If your question isn't answered here, try asking me or Mike Tie in CMC 305.

Installing the required software on macOS

To run the software for the first half of this course, you need OpenGL, a C compiler, and GLFW. The macOS operating system comes with OpenGL preinstalled (because it runs all graphics through OpenGL). 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. All that remains is GLFW. Here is how I did it (mimicking this page, by the way).

Install cmake

  1. Download and install MacPorts. This is a package manager, kind of like rpm or apt-get on Linux. Its job is to install software, including the libraries on which that software depends, automatically.
  2. In Terminal, do sudo port install cmake. This command tells MacPorts to install a tool called cmake, that doesn't seem to be pre-installed with the macOS developer tools.

I'm told that you can install cmake, but not GLFW, through Homebrew instead of MacPorts.

Can you use the GUI cmake instead of the command-line version that I just told you to install? I doubt it, but I don't know.

Install GLFW

  1. Download and unarchive the GLFW source code (not a binary package).
  2. cd to the top-level glfw folder.
  3. mkdir build
  4. cd build
  5. 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.

I'm told that installing GLFW through Homebrew leads to some kind of failure. Instead, follow the instructions above.

Test

Test your GLFW installation against the small sample program offered in the GLFW documentation. Also test your C compiler against 000helloWorld.c, ..., 000functions.c. Once those are working, try to get 000linking.c working. It's possible that you will need to compile your own copy of 000pixel.o. I can help you with that.

Install GL3W

Here are instructions for installing GL3W, which we need in the last part of our course, for macOS.

  1. In a web browser, download GL3W. Double-click to unarchive it.
  2. mv gl3w-master /usr/local/gl3w
  3. cd /usr/local/gl3w
  4. cmake .
  5. python3 gl3w_gen.py
  6. cd src
  7. clang -I ../include gl3w.c -c
  8. cd ../include
  9. cp -rp GL /usr/local/include

Here are two tests. When working correctly, they both open windows that flash random colors.

  1. cd /usr/local/gl3w/src
  2. clang -o glfw_test glfw_test.c /usr/local/gl3w/src/gl3w.o -framework OPENGL -framework GLUT -framework CoreFoundation /usr/local/lib/libglfw.dylib
  3. ./glfw_test
  4. clang -o test-1 test.c /usr/local/gl3w/src/gl3w.o -framework OPENGL -framework GLUT -framework CoreFoundation
  5. ./test-1

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."

Installing the required software on Windows?

You will not be able to work on Windows for the first half of our course, because we are using my 000pixel.o library, and rewriting it for Windows would require some redesigning. Once we stop using 000pixel.o and start using raw OpenGL, you should be able to work on Windows.

To run the software for this course, you first need OpenGL, a C compiler, and GLFW. Microsoft does not package OpenGL with Windows, because they prefer their own Direct3D. So download and install OpenGL. I'm told that you get your C compiler from Visual Studio. GLFW should be installable, perhaps even from a binary package, but I don't know the details of that. If you figure them out, then please let me know.

Once you've figured all of that out, test your GLFW installation against the small sample program offered in the GLFW documentation. Also test your C compiler against 000helloWorld.c, ..., 000functions.c.

For the last weeks of the course, you may also need to install GL3W. It might depend on your driver situation.

Installing the required software on Linux?

To run the software for this course, you need OpenGL, a C compiler, and GLFW. Most Linux distributions come with OpenGL preinstalled. If you're a Linux user, then surely you also have a C compiler such as gcc. All that remains is GLFW. I don't know much about that, but I would start by trying the instructions here.

Once you have GLFW installed, test it against the small sample program offered in the GLFW documentation. Also test your C compiler against 000helloWorld.c, ..., 000functions.c. Once those are working, contact me to obtain 000pixel.c, which you will compile to 000pixel.o. Then test 000linking.c.

For the last weeks of the course, you may also need to install GL3W. It might depend on your driver situation.