Course overview. This course is an introduction to 3D computer graphics, covering the mathematical foundations and 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.

Class time/location: Peterson Hall 103, MWF 11:00am-11:50am.
   Computer lab primarily in APM B325; secondarily B337/B349 and B349.
   Class schedule as google calendar: HTML link and ICAL link.

Instructor: Professor Sam Buss
   Office: APM 7456
   Email: sbuss@ucsd.edu
   Phone: 848-534-6455 (mainly for voice messages)
   Office hours: Default office hours (see the calendar above for changes),
      In APM 7456: Monday, 4:00-5:00pm; Thursday 2:00-3:00.
      In APM B324: Monday, 12:30-1:20; Wednesday, 1:00-2:00; Friday 12:30-1:30. (computer lab)

Teaching Assistants:

   Jonathan Conder.
      Email: jconder@ucsd.edu
      Computer lab hours in APM B325:.
         Please see the calendar above.
   Xiudi Tang.
      Email: xit014@ucsd.edu
      Computer lab hours in APM B325:.
         Please see the calendar above.

Homework Assignments (Answers sheets posted via piazza course web page.)
   Homework #1. Due Monday, January 29, 9:00pm.
      Turnin via GradeScope only. Also available: LaTeX source file.
   Homework #2. Due Monday, February 5, 9:00pm.
      Turnin via GradeScope only. Also available: LaTeX source file.
   Homework #3. Due Wednesday, February 28, 11:00pm.
      Turnin via GradeScope only. Also available: LaTeX source file.

Programming Assignments
   Project 0: Getting Started. Due Friday, January 11, 9:00pm.
      Once you complete the work, hand it in by filling out the form at https://goo.gl/forms/9KayYX1doBWUp6uT2.
   Project 1: Two hexagonal prisms. Due Friday, January 19, 9:00pm.
      Grading will be in-person with a TA or Professor Buss.
   Project 2: Solar system with moons, moonlet, planet X, and a tilt. Due Friday, January 26, 9:00pm.
      Grading will be in-person with a TA or Professor Buss.
   Project 3: Animated initial with ellipsoids and cylinders. Due Friday, February 2, 9:00pm.
      Grading: Source code and a PDF file must be uploaded to gradescope. In-person with a TA or Professor Buss, but may be postponed to be done together with Project #4.
   Project 4: Remeshable plane and surface of rotation with surface normals. Due Friday, February 16, 9:00pm.
      Grading: Source code and a PDF file must be uploaded to gradescope. In-person with a TA or Professor Buss.
   Project 5: Phong lighting with initial, ground plane and surface of rotation. Due Friday, February 23, 9:00pm.
      Grading: In-person with a TA or Professor Buss. (No gradescope hand-in.)
   Project 6: Add textures to a scene. Due Friday, March 2, 9:00pm.
      Grading: In-person with a TA or Professor Buss. (No gradescope hand-in.)
   Project 7: Individual project. Due Wednesday, March 14, with extension possible to Friday, March 16, 11:00pm.
      Grading: In-person with a TA or Professor Buss. Gradescope hand-in also required.

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 NOT: hand in someone else's code as your own, or directly copy code from others. 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. If you are not sure what is permitted, please talk with a TA or Professor Buss.

Midterm and final exam schedule:
   Midterm #1: February 7. Study problems for midterm 1, modified from old midterms.
   Midterm #2: March 7. Study problems for midterm 2, modified from old midterms.
   Final: Monday 11:30-2:30, March 19. Final is cumulative, covering the entire course. Study problems for new topics on the final.

In class quizes    Dates and topics to be announced in class and on piazza.
   These will be short, approximately 10 minutes; and should be graded 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 http://acms.ucsd.edu.
Grading of programming projects will be one-on-one with a TA 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.

Piazza. Please watch piazza for important course announcements. You are encouraged to post questions (and answer questions as well). 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, one midterm score may be dropped, in which case the final exam will be 30% of the course grade. The homework assignments and quizes will be together 10% of the grade (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 preannounced, and held in the final 10 minutes of the lecture.

Other resources

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

If you are programming at home, you may need to install the OpenGL header files and .lib library files. GLFW and GLEW. To obtain these for Windows, download the header files GL/glew.h, GLFW/glfw2.h and GLFW/glfw3native.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 http://www.glfw.org/download.html and http://glew.sourceforge.net/.
For other systems, source files and makefiles are available for download to compile yourself. Updated advice from Jonathan Conder: 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.

Course prerequisites. Math 20C and 20F (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. However, please discuss it with Professor Buss if you do not have programming experience with any of C, C++ or Java.

Textbook: 3D-Computer Graphics: A Mathematical Introduction with OpenGL, by S. Buss (your instructor). It is also on reserve at the library. Math 155A will cover chapters 1 through 7 of the textbook. Please note the textbook uses "Legacy OpenGL" in its code examples; this course is upgrading to "Modern OpenGL". A lot (but not all) of the code examples in Chapter 1 and Chapter 2 use legacy OpenGL, and thus are not applicable to this course. You will be provided with examples of the equivalent "Modern OpenGL" code in handouts and during lectures.