THIS PAGE IS FOR AN OLD COURSE!

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.

Textbook: 3D-Computer Graphics: A Mathematical Introduction with OpenGL, by S. Buss (your instructor). It will be on reserve at the library. Math 155A will cover chapters 1 through 7 of the textbook. Please note the textbook uses "Legacy (Immediate Mode) OpenGL" in its code examples; but the course has been upgraded to "Modern OpenGL". I am currently working on a potential second edition to the textbook that incorporates Modern OpenGL and other updates, and will make PDF copies available to you as they are ready. 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 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: Warren Lecture Hall 2111, MWF 1:00pm-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
   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: To be announced.
      In APM B324: To be announced. (Computer lab)

Teaching Assistants:

   Jonathan Conder.
      Email: jconder@ucsd.edu
      Computer lab hours in APM B325:.
         Please see the calendar above.
   Nicholas Sieger.
      Email: nsieger@ucsd.edu
      Computer lab hours in APM B325:.
         Please see the calendar above.

Homework Assignments (Most answers will be available via gradescope answer key.)
   Homework #1. Due Tuesday, January 29, 9:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
   Homework #2. Due Monday, February 4, 9:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
      Answers now available.
   Homework #3. Due Wednesnday, February 20, 9:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
   Homework #4. Due Wednesday, February 27, 9:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
   Homework #5. Due Tuesday, March 5, 4:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
      Homework 5 answers available at 4:10pm after due time.
Quiz 7 answers are available.
   Homework #6. Due Thursday, March 14, 9:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
   Homework #7. Due Wednesday, March 20, 9:00pm.
      Turnin via GradeScope (gradescope.com). Also available: LaTeX source file.
      Answers available for download.

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/hkaTD3UEnQbHhrUw2.
   Project 1: Two tent shapes. Due Friday, January 18, 8:00pm.
      Grading will be in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 2: Complex solar system.. Due Friday, January 25, 8:00pm.
      Grading will be in-person with a TA or Professor Buss. Hand in also on gradescope.
   Project 3: Animated letter (Your initial).. Due Friday, February 1, 9:00pm.
      Grading will be in-person with a TA or Professor Buss. Can be postponed to be done at the same time as Project 4 grading. Hand in also on gradescope.
   Project 4: Surface of rotation. Due Friday, February 15, 9:00pm.
      Grading will be in-person with a TA or Professor Buss.
      There is a handout Avoiding some floating point pitfalls that gives advice on how to loop over angles.
   Project 5: Lighting and materials. Due Friday, February 22, 9:00pm.
      Grading will be in-person with a TA or Professor Buss.
   Project 6: Bitmapped and procedural texture maps. Due Friday, March 1, 9:00pm.
      Grading will be in-person with a TA or Professor Buss. There are gradescope hand-ins as well.
   Project 7: Design an individual project. Due Friday, March 15, 9:00pm.
      Grading will be in-person with a TA or Professor Buss. There are gradescope hand-ins as well. Gradescope Upload Instructions Have Been Updated!

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, directly copy code from others, or work too closely with one person for the entire quarter. 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. (Any help you get from a TA or Professor Buss is permitted of course!)

Midterm and final exam schedule:
   Midterm #1: Wednesday, February 6. Study problems for midterm 1, modified from old midterms. Review session with Prof. Buss, Peterson Hall 104, Tuesday, February 5, 5:00-6:30.
   Midterm #2: Wednesday, March 6. Study problems for midterm 2, modified from old midterms. Review session with Prof. Buss, Peterson Hall 104, Tuesday, March 5, 5:00-6:30.
   Final: Friday 11:30-2:30, March 22. Final is cumulative, covering the entire course.
    Study problems for final exam, modified from old finals. (Only covers material new since midterm 2.).

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 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 https://learnopengl.com. These provide both an introduction to OpenGL and discussion of more sophisticated language features. Another web site with nice tutorials is http://lighthouse3d.com. Many other tutorials and resources can be found at https://www.opengl.org. 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 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/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 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.
More info for installing Windows for Visual Studio: The zip file GLEW_GLFW.zip has all the needed files and the instructions given to ACMS to install GLEW and GLFW for the computer lab this quarter. Similar instructions should work for most Windows 7 or 10 machines.
Updated advice from 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.