Course overview. This course is an introduction to 3D computer graphics, covering the mathematical foundations and "modern" OpenGL programming. Topics covered include: linear and affine transformations, homogeneous coordinates, perspective, Phong lighting and Cook-Torrance lighting, interpolation, the Bresenham algorithm, spherical interpolation, hyperbolic interpolation, texture mapping, and Bézier curves. The course grade will be based 50% on exams/homeworks/quizes and 50% on programming assignments.

Online textbook and other materials:

Textbook: 3D-Computer Graphics: A Mathematical Introduction with OpenGL, by S. Buss (your instructor). Math 155A will cover chapters 1 through 7 of the textbook. The first edition will be on reserve at the library, but the course will be using the -- in preparation version --- of the second edition of this book. The second edition to the textbook incorporates Modern OpenGL and other updates. Downloadable PDF copies will available to you as they are ready --- see the link above. SO YOU CAN GET BY WITHOUT PURCHASING THE TEXT BOOK.

Course prerequisites. Math 20C and 18 (Multivariable calculus and Linear Algebra) or Math 31AH. Programming assignments will be in C++ using the Modern OpenGL API. However, the course will not use any advanced features of C++, so experience with any similar language such as C or Java is sufficient preparation. Programming experience in other languages should be fine too. Please discuss it with Professor Buss if you do not have programming experience with any of C, C++ or Java. Occasionally students without any prior programming experience have successfully taken the course. There is a brief handout describing the basic C++ features needed for 155A available.

Class time/location: Peterson Hall 102, Tuesday-Thursday 12:30-1:50pm.
   Computer lab primarily in APM B325; secondarily B337/B349 and B432.

Class schedule as a google calendar: HTML link.

Instructor: Professor Sam Buss
   Office: APM 7456
   Phone: 442-2877 (personal cell phone, area code 858)
   Office hours: Default office hours (see the calendar above for changes),
      In APM 7456: To be announced.
      In APM B324: To be announced. (Computer lab)

Teaching Assistants:

   Jonathan Pham.
      Computer lab hours in APM B325:.
         TO BE ANNOUNCED. Please see the calendar above.
   Inderjot Singh Saggu.
      Computer lab hours in APM B325:.
         TO BE ANNOUNCED. Please see the calendar above.

Homework Assignments (Most answers will be available via gradescope answer key.)
   Homework #1. Linear and affine transformations.
      Turnin via GradeScope (
   Homework #2. Linear and affine transformations in R3 and triangle fans.
      Turnin via GradeScope (
   Homework #3. Shearing and perspective transformations in R3.
      Turnin via GradeScope (
      Now available: Answers to Homework #3.
   Homework #4. Normal vectors to surfaces.
      Turnin via GradeScope (
   Homework #5. Interpolation.
      Turnin via GradeScope ( Answers available after upload deadline.
   Homework #6. Specular exponent, Hyperbolic interpolation, Bezier curve.
      Turnin via GradeScope (
   Homework #7. Color, Bezier curves.
      Turnin via GradeScope ( To be available after the due time: Answers to Homework #7.

Programming Assignments
   Project 0: Getting Started. Due Friday, January 10, 9:00pm.
      Once you complete the work, hand it in by filling out the form at
   Project 1: Hex Diamond with flat and smooth shading. Due Friday, January 17, 8:00pm.
      Grading will be during the week of January 20, in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 2: Solar system with Planet X, a torus and a tilt.. Due Friday, January 24, 8:00pm.
      Grading will be during the week of January 27, in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 3: Initial (letter) with animation.. Due Friday, January 31, 8:00pm.
      Grading will start the week of February 3, in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 4: Remeshable plane and surface of rotation.. Due Friday, February 14, 8:00pm.
      Grading will start the week of February 17, in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 5: Phong lighting.. Due Friday, February 21, 8:00pm.
      Grading will start the week of February 24, in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 6: Texture maps.. Due Friday, February 28, 8:00pm.
      Grading will start the week of March 3, in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 7: Individual final project.. Due Friday, March 13, 9:00pm.
      Grading will start the final week of instruction, in-person with a TA or Professor Buss. Hand in also on gradescope.

Programming assignments are individual projects. It is OK to get help from other students or other sources including the internet, but the actual work must be your own. In particular, you should definitely NOT: hand in someone else's code as your own, directly copy code from others, or work too closely with one person for the entire quarter. These will be viewed as serious violations of academic integrity. It is OK however to see someone else's code, and then take a short break (say, three minutes) and then write your own version of the code on your own. If you are not sure what is permitted, please talk with a TA or Professor Buss. (Any help you get from a TA or Professor Buss is permitted of course!)

   Floating point perils. This is for an old class that did not use Modern OpenGL. Therefore only items 1.-3. in the handout (to the top of second page) are relevant for Programming Project 4.

Midterm and final exam schedule:
   Midterm #1: Thursday, February 6, 2020. Study problems from prior years are available.
   Midterm #2: Tuesday, March 3, 2020. Study problems from prior years are available.
   Final: Tuesday 11:30-2:30, March 17. Final is cumulative, covering the entire course. Study problems from prior years are available.
Click to: DOWNLOAD THE FINAL EXAM after 11:25am.

In class quizes    Dates and topics to be pre-announced in class and on piazza.
   These will be short, approximately 10 minutes, at the end of a lecture We plan to grade and return them quickly.

Computer Labs The APM basement computer labs APM B325, B337/B349 and B432 are available to the class for programming work. The computer lab doors are unlocked during week days at least: for other times, there is a door code available online using Account Lookup under Tools at
Grading of programming projects will be one-on-one with one of the TA's or Professor Buss. If you work at home or on other computers, you must transfer your programming projects to the APM computer lab systems: your program must be able to compile and run on the APM systems for grading.

Piazza. Please watch piazza for important course announcements. You are strongly encouraged to post questions (and answer questions as well). An example what you might post is a screenshot of your program's output, asking about what the problem might be. However, do not post code from your programming assignment!
If you add the class once the quarter has already started, please email Professor Buss for an invitation to the piazza course page.

Grading: The course grade will be based 50% on programming assignments, and 50% on homeworks, short quizes, midterms and the final. The final is worth 20%, and the midterms are graded 10% each. However, if it helps your grade, one half of one midterm score may be dropped; in this case the final exam will be 25% of the course grade,one midterm will worth 10% and the other worth 5%. The homework assignments and quizes will be together 10% of the grade (exact percentages to be determined). There will be only a handful of quizes, and the lowest quiz score will be dropped. Quizes and their topics will be pre-announced, and held in the final 10 minutes of the lecture.

Other resources

The upgraded course textbook web page has some introductory sample OpenGL programs (some of them are still under development). I highly recommend them as a way to see examples of how Modern OpenGL is used.

Another excellent source for learning how to use OpenGL is the web pages by Joey De Vries at These provide both an introduction to OpenGL and discussion of more sophisticated language features. Another web site with nice tutorials is Many other tutorials and resources can be found at Last, but not least, the Khronos Group leads the development of OpenGL; if you do browser searches for topics in OpenGL, you are likely to find their web pages giving the most official version of the documentation.

If you are programming at home, you have free use of Visual Studio for use as a UCSD student. In addition, you probably need to install the OpenGL header files and .lib library files, GLFW and GLEW. To obtain these for Windows either see the next paragraph, or download the header files GL/glew.h, GLFW/glfw3.h and the binary static libraries glew3.lib, glew32s.lib, glew32.lib. These are then needed to be installed in your system directory (logging in as an administrator) in the default system include directory for headers and the default system directory for static libraries. You can search for GL/gl.h or GL/glu.h opengl32.lib or glu32.lib to find these system folders. These header and static library files can be obtained online from GLFW and GLEW distribution sites, at and
For other systems, source files and makefiles are available for download to compile yourself.
More info for installing Visual Studio on Windows: The zip file has all the needed files and the instructions given to ACMS to install GLEW and GLFW for the computer lab last year. Similar instructions should work for most Windows 7 or 10 machines.
Updated advice for non-windows systems (thanks to Jonathan Conder in Winter 2018): On Linux, your distribution probably has a package for GLEW and GLFW. On Debian, Mint, Ubuntu etc. they seem to be called libglew-dev and libglfw3-dev. On Arch, they are glew-wayland and glfw-wayland (or glew and glfw-x11 if you're not using Wayland yet). I would recommend using these over compiling stuff yourself. For Mac there is something called MacPorts, which should make it easier to compile the libraries (and uninstall them when you're done). Visual Studio 2015 (express) also has a built-in package manager called NuGet, which I tried to use but ran into issues (the "glew" package is out of date, so you have to use "glew.v140," but VS doesn't expect packages to have dots in their name so it doesn't let you enable static linking). You might have more luck with an older (or newer) version of VS.