2019 March 23,

CS 311: Computer Graphics

Carleton College, Winter 2019

Joshua R. Davis, , CMC 324, x4095


This is a first course in computer graphics. Our goal is to understand the theory and methodology underlying computer-generated films, video games, scientific visualizations, etc. The course proceeds in three parts:

  1. We begin with a minimal hardware interface that lets us make a window and set individual pixels to specified colors. Atop this primitive foundation we implement triangle rasterization, texture mapping, and vertex and fragment shaders in 2D. Then we transition to 3D and add projections, depth buffering, clipping, lighting, etc.
  2. We re-write our triangle-rasterizing graphics engine to use hardware acceleration. We focus on shader-based hardware (OpenGL 2.x-4.x), although we also glimpse fixed-function hardware (OpenGL 1.x) and lower-level interfaces (Vulkan). We add computationally expensive features such as shadow mapping.
  3. We implement ray tracing based on the same minimal hardware interface as in the first part of the course. Features include shadows, mirror reflections, and refraction.

The only prerequisite for this course is CS 201: Data Structures. We need some of its specific content such as graphs and stacks. More importantly, students must have maturity in thinking algorithmically and learning on their own. Students are expected to learn C and basic linear algebra such as multiplying matrices. I provide tutorials to teach the essentials of these subjects, but I do not spend much class time on them.

Our class meets in CMC 210 during period 2A (MW 9:50-11:00, F 9:40-10:40). My office hours are

During office hours, no appointment is needed; just drop in. If you cannot attend office hours, then consult my weekly schedule and e-mail me to ask for an appointment, listing several times at which we could meet.


Here are some general external resources. Notice that there is no required textbook.

Here are some resources produced by me specifically for this course.


Final grades (A, B, C, etc.) are assigned according to an approximate curving process. By this I mean that there are no predetermined percentages (90%, 80%, 70%, etc.) required for specific grades. The following elements contribute to the final grade.

You are expected to spend at least 10 hours per week on this course outside class. Some students need to spend more than 10 hours. If you find yourself spending more than 15 hours, then talk to me.

Working with Others

For some assignments the students are expected (but not required) to work in pairs. Your pair hands in a single copy of the assignment with both names on it. You are encouraged to talk with other pairs — to bounce ideas off them — but the work that you submit must be the work of your own pair. The two members of a pair must contribute roughly equally.

Other assignments may be individual. Even on these assignments, you are encouraged to talk with other students. In the end, however, you write or type your own solutions, in your own words.

You may not copy someone else's work or allow them to copy yours — in person, over the Internet, etc. Presenting someone else's work as your own is an act of academic dishonesty. The College requires me to report you if I suspect that you have not upheld its Academic Integrity standards.

Special Accommodations

If some medical condition affects your participation in class or your taking of exams, let me know in the first week of class. You may also need to make official arrangements with the Disability Services for Students.

In most courses that I teach, homework is assigned daily and collected weekly. I declare a "one free late pass" policy. Students can hand in any one assignment a week late, with no questions asked. In this course, however, we are building fairly large, ongoing software, and each day's code builds on the day before's. You simply must keep up with the homework.

So here is the tentative policy for this course: If you cannot complete a homework assignment on time, then you must talk to me, in person, within one day of the due date. I reserve the right to change this policy.


We use OpenGL/Vulkan because, unlike Direct3D and Metal, it is a non-proprietary industry standard available for many operating systems. In theory, all of our software can be compiled and executed on any recent computer running Windows, macOS, Linux, etc.

In practice, I supply instructions for compiling and running our software in macOS on the lab machines in CMC 306 and CMC 304. You are welcome to program on your own computer, but you will have to set it up yourself following the installation instructions above. In any case, your code will be graded under macOS on the lab machines. So be sure that it runs correctly there.

We program in C for three reasons. First, graphics requires speed, and C produces fast programs. Second, C is the native language for communicating with OpenGL. Third, C is ubiquitous enough that every advanced computer science student should be proficient in C.


This schedule is tentative. It is adjusted and filled in as we go along.

M 1/0701overview, color, vector vs. raster graphicsDay 01Pixar, Cryptocurrency
W 1/0902rasterizing a triangle, interpolationDay 02
F 1/1103interpolation, texture mappingDay 03
M 1/1404texture mapping, abstracting pixel colorationDay 04
W 1/1605abstracting pixel coloration, meshDay 05
F 1/1806mesh, rotation, translation, abstracting vertexDay 06
M 1/2107homogeneous coordinates, lab workDay 07
W 1/2308transition to 3D, mesh, backface cullingDay 08
F 1/2509depth testDay 09
M 1/2810camera, orthographic projection, viewportstudyFuturama, Q*bert, Diablo, Architecture
W 1/3011Exam ADay 11
F 2/0112perspective projection, clippingDay 12Dolly Zoom
M 2/0413clipping, perspective interpolation, summaryDay 13
W 2/0614diffuse and specular reflectionDay 14Vermeer, Wright, Renoir, Degas, Welles (around 3:35)
F 2/0815ambient, positional, fog, attenuation?Day 15
M 2/11Midterm Break
W 2/1316OpenGL 1.xDay 16300glfw.c, 300openGL14.c, 300openGL15.c
F 2/1517OpenGL 2.xDay 17300shading.c, 300openGL20.c, 300openGL20b.c
M 2/1818OpenGL 3.2, Vulkan, texture mappingDay 18300openGL32.c, 300string.c
W 2/2019spot lights, shadow mappingDay 19
F 2/2220shadow mappingDay 20PCF, PCSS
M 2/2521picking, summarystudy
W 2/2722Exam BDay 22
F 3/0123basic ray tracing, spheresDay 23
M 3/0424lighting, shadows, mirrorsDay 24
W 3/0625cylinders, planes, bodiesDay 25
F 3/0826lights, recursive ray tracingDay 26
M 3/1127transmission, refraction, translucencyDay 27
W 3/1328What haven't we learned?studyFurther Reading
S 3/16Exam C 3:30PM-6:00PM