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 approximately 50% on exams and quizzes and 50% on programming assignments.

Class meetings in Warren Lecture Hall 2205, Tuesday and Thursday, 9:30-10:50pm. Section meetings are replaced by individual meetings in the computer labs.

Online textbook, videos, and software resources:

The textbook web page at https://math.ucsd.edu/~sbuss/MathCG2 contains: Other online resources:

Grading: The course grades are based 50% on written quizzes, homeworks and exams, and 50% on programming assignments.
Quizzes will be 10% of the course grade. There will be frequent quizzes and few, if any, homework assignments. You may drop your lowest 1/3 quiz grades. In addition, you may optionally drop any quiz that is held during week 1 (Sept. 27 and 29)
The midterms and final are worth together 40% of your course grade. You have an options on how much the midterm and final count towards your grade: (1) The midterm score can be dropped and the final exam is 40% of your course grade, or (2) The midterm and final exam are each worth 20% of your grade.
There will be seven graded programming projects, together worth 50% of the course grade. The final project (Project #7) is an individual project and worth double the other projects.
Grading policies are subject to adjustments if needed.

Quizzes: Frequent quizzes, administered in the last 15 minutes of most class. The quizzes will take 15 minutes; the topics will be preannounced to allow for targetted study and preparation.

Midterms and final: The midterm is in-person only, during the regular course meeting time on Tuesday, November 15. The final, also in-person only, is during final exam week at the time and date given in the UCSD schedule of classes (Thursday, 8:00-11:00am). See the day-by-day syllabus and piazza announcements for topics and downloadable study problems.

Textbook: 3D-Computer Graphics: A Mathematical Introduction with OpenGL, by S. Buss (your instructor). A second edition of this book is in preparation, and we will use the second edition, not the first edition. The second edition to the textbook incorporates Modern OpenGL and other updates. The course will cover most of chapters 1 through 8 of the second edition of textbook. A downloadable PDF copy is available at the link above. SO YOU SHOULD NOT PURCHASE THE TEXT BOOK.

Course prerequisites. Math 20C and 18 (Multivariable calculus and Linear Algebra) or Math 31AH. Programming experience. 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 such as Python 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. Be sure to get assistance from the professor or TAs if you do not have prior experience with programming!

Class schedule as a google calendar: HTML link.

Instructor: Professor Sam Buss
   Office: APM 7456.
   Email: sbuss@ucsd.edu
   Phone: 442-2877 (personal cell phone, area code 858). Texting is OK, especially to get hold me quickly.
   Office hours: Default office hours (see the calendar above for changes),
      TBA

Teaching Assistants: See the course calendar for computer lab office hours, any monitor piazza for updates on lab office hour times.

   Patrick Girardet.
      Email: pgirarde@ucsd.edu

   Arseniy Kryazhev.
      Email: akryazhev@ucsd.edu

   Nicholas Sieger.
      Email: nsieger@ucsd.edu

Programming Assignments
   Project 0: Getting Started. Due Friday, September 30.
      Once you complete the work, hand it in by filling out the form at https://forms.gle/weS5yvLVZu8PzoSbA. No other turn-in or grading is required for Project #0.
   Project 1: Obelisks. Due Friday, October 7, 10:00pm. Also available: the example of z-fighting to be shown in lecture.
   Project 2: Solar system. Due Friday, October 14, 11:00pm.
   Project 3: Animated initial. Due Friday, October 21, 11:00pm.
   Project 4: Surface of rotation with normals. Due THURSDAY, November 3, 11:00pm.
   Project 5: Phong lighting. Due THURSDAY, November 10, 11:00pm.
   Project 6: Texture maps. Due Monday, November 21, 11:00pm.
   Project 7: Final project on an individual topic. Due Monday, December 5, 11:00pm. Schedule a final project grading session at the online signup page.
Hand in projects 1-7 by turning a zip file at Gradescope. You will graded by a in-person, individual grading session with a TA or Professor Buss in the APM computer labs.

Programming assignments are individual projects. It is permitted to get help from other students or other sources including the internet or of course a TA or the professor, but the actual work should be your own. 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!)

Handouts
Brief introduction to some of the C++ commands needed for the 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.

Quizzes. There will short quizzes in most classes. Topics will be pre-announced. Quizzes will be short, approximately 15 minutes. You may drop one-third of the quizzes. Quizzes are intended to be low-stakes and easy to study for since they will focussed on pre-announced topics.

Computer Labs. There are three main options for your programming projects. (A) Use the computers in the APM computer labs, APM B349 and APM B347. (B) Use the online browser-based Cloudlabs system at cloudlabs.ucsd.edu using "AppStram Math 155A Desktop". (C) Install Visual Studio (or other IDE) and OpenGL and the required libraries on your personal computer. Most students will probably wish to use options (A) and (B), and it is recommended to use (A). Option (C) is an excellent choice for students who are more engaged in programming outside of 155A.

Starting with the second project (Project #1), programs will be turned in by uploading (a) a PDF report and (b) designated source files. They will be graded with one-on-one discussions with a TA or Profesor Buss. Detailed instructions will be forthcoming.

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!

Other resources

The upgraded course textbook web page has some introductory sample OpenGL programs, along with pages documenting how the code works. These are highly recommended as a way to see examples of how Modern OpenGL is used. If you want to learn to write OpenGL programs from scratch, this is a great place to start.

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

Installing OpenGL, with GLEW and GLFW on your own Windows system. This is optional, but some students may wish to program on their personal computer. Instructions are provided here for Windows; it can also work for linux and older Macintosh systems. For Windows: 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 need 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 Visual Studio on Windows: 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 last year. Similar instructions should work for most Windows 10 machines. (I have not tried this on a Windows 11 machine yet; please let me know if the instructions need updating for Windows 11.)
There are other workarounds that can be used for installing GLEW and GLFW for Visual Studio on Windows systems. Please post to piazza if you are having difficulties.
Updated advice for non-windows systems (This is advice from Jonathan Conder in Winter 2018.) On Linux, you can use gcc, and 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.
If you install OpenGL with GLEW and GLFW for Linux or Mac please post information on you did it to the piazza course page, so that other students can benefit from it.
Unfortunately, Apple has "deprecated" OpenGL and it only works on older Macintosh systems. In prior courses, some students have successfully used OpenGL on Macintosh systems and other have not been able to.