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 Center Hall 115, Tuesday and Thursday, 3:30-4:50pm.

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 and homework will be 10% of the course grade. There will be frequent quizzes and infrequent homework assignments. You may drop your lowest 1/3 quiz grades.
The midterms and final are worth together 40% of your course grade,, with the final worth the same as two midterms. However, you may drop one midterm score or half the final exam score. (So either one midterm is 13.3% and the final exam is 26.6%, or the midterms and final are each worth 13.3%.)
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. There is also an option to take quizzes online within two hours of the class meeting. The quizzes will take 15 minutes; the topics will be preannounced.

Midterms and final: The midterms are in-person only, during the regular course meeting time on Thursday, April 28 and Thursday, May 26. The final, also in-person only, is during final exam week at the time and date given in the UCSD schedule of classes.

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:

   Chaitanya Animesh.
      Email: canimesh@ucsd.edu
      See the calendar for computer lab office hours.
   Abhinav Gupta.
      Email: abg004@ucsd.edu
      See the calendar for computer lab office hours.
   Tina Jin.
      Email: dojin@ucsd.edu
      See the calendar for computer lab office hours.
   Soham Pachpande.
      Email: spachpan@ucsd.edu
      See the calendar for computer lab office hours.

Programming Assignments
   Project 0: Getting Started. Due Friday, April 1.
      Once you complete the work, hand it in by filling out the form at https://forms.gle/oYscdjwxoMN5QMDTA. No other turn-in or grading is required for Project #0.
   Project 1: 5-sided tents. Due Friday, April 8, 10:00pm. Also available: the example of z-fighting shown in lecture.
   Project 2: Update the solar system.. Due Friday, April 15, 10:00pm.
   Project 3: Construct and animate your initial.. Due Friday, April 22, 10:00pm.
   Project 4: Construct remeshable surfaces with normals.. Due Friday, May 6, 10:00pm.
   Project 5: Add Phong lighting to the Project 4 scene.. Due Friday, May 13, 10:00pm.
   Project 6: Textures maps and procedural texture map.. Due Friday, May 20, 10:00pm.
   Project 7: Individual Final Project.. Due Friday, June 3.
      Hand in projects 1-7 by (a) 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. Quizzes are given in class, with an option to take it online instead. Download the general quiz instructions.
There will short quizzes in most classes. Topics will be pre-announced. Quizzes will be short, approximately 15 minutes. Quizzes are intended to be low-stakes and easy to study for since they will focussed on pre-announced topics. You should not discuss a quiz with students who have not taken the quiz until the time window for the quiz has passed.

Computer Labs. There are three main options for your programming projects. (A) Use the computers in the APM computer labs, APM B349 and APM B???. (B) Use the browser-based online the Cloudlabs system at cloudlabs.ucsd.edu using "AppStram ECE General 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).

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.

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