W Randolph Franklin home page
... (old version) Login

External links

Further down this page


There will be about a dozen homeworks.

Due Questions Solution
Sep 2 Homework 1 Solution1.pdf
Sep 9 Homework 2 Solution2.pdf
Sep 16 Homework 3 Solution3.pdf
Sep 26 Homework 4 Solution4.pdf
Oct 17 Homework 5

Lectures and labs day-by-day

No Date Summary
1 Tues Aug 26

Topics: Syllabus and Intro.

  1. AngelCG01.ppt: What is Computer Graphics?
  2. Angel, chapter 1.


  1. Room change to Lally 104 (Tues and Fri) and J-Rowl (aka Science Center) 2C22 (Wed)
  2. Homework 1 available, due Sep 2.
2 Wed Aug 27

Topics: Chance to ask questions about homework
Announcements: It's ok to render the NCC1701 as polygons, if you wish.

3 Fri Aug 29

Topics: Chapter 1. Notes:

  1. What physical principles are each type of HW based on?
    1. CRT: certain rare earth materials emit photons when hit by electrons. Explaining this is what got Einstein his Nobel (not relativity).
  2. What engineering challenges required solving?
    1. Shadow-mask CRT: electron beams travel varying distances at different angles, but don't hit the wrong phosphor even as the system gets hotter. The precision is 0.1%.
  3. What tech advances enabled this solution?
    1. Raster graphics required cheap memory.


  1. AngelCG02.ppt: Image Formation

Announcements: Midterm exam date fixed at Wed Oct 8

4 Tues Sep 2


  1. Engineering Grounded In Reality
  2. A little on API philosophy, e.g, Portability And Standards, and submarine patents.
  3. AngelCG03.ppt: Models and Architectures

Reading: Announcements:

  1. Homework 2 available, due Sep 9.
5 Wed Sep 3


  1. chance to talk to Jixu about homework
6 Fri Sep 5


  1. AngelCG04.ppt: Programming in OpenGL I
  2. simple2.c - simplest OpenGL program. Features:
    1. including required include file
    2. initializing OpenGL
    3. creating a top level window of default size and position
    4. setting window title
    5. defining and registering a display callback
    6. entering the main event loop
    7. clearing the frame (aka color) buffer to a default color (black)
    8. drawing a polygon with the default color (white)
    9. forcing pipeline to flush
    10. compiling and linking
  3. simple3.c - slightly bigger OpenGL program
    1. setting vertex colors and observing polygon color
    2. overlapping polygons
  4. simple4.c - version created in class
  5. my Makefile - YMMV
  6. AngelCG05.ppt: Programming in OpenGL II

Announcements: To compile the OpenGL examples in Visual C: If you get a redefinition error for exit, then do not include stdlib.h in your program. It is already included by another include file, and it lacks an inclusion guard.

7 Tues Sep 9


  1. AngelCG06.ppt: Programming in OpenGL III
  2. Demo, discuss, and modify shape_test.c. New features:
    1. OpenGL datatypes like GLfloat
    2. Allocate and enable depth (aka Z) buffer
    3. Perspective view
    4. Several utility polyhedra
      1. sphere, cone, cube, torus, dodecahedron, teapot, octahedron, icosahedron
      2. wire or solid
    5. Light source and color
    6. Enabling and disabling lighting
    7. Reshape callback
    8. Push and pop transformation matrix
    9. Rotate, scale, translate transformations
    10. Using viewport to draw into a small region of the window. Anything outside the viewport is clipped.
  3. AngelCG07.ppt: Input and Interaction
  4. Demo, discuss, and modify gasket2.c . Features:
    1. Array of vertices passed to glVertex2fv
    2. Array of triangles
    3. Recursively creating the graphic object
    4. glBegin and glVertex2fv are in different routines. It's the order in which they are executed that matters, not their order in the source file.
    5. Parallel (ortho) projection.
  5. Demo, discuss, and modify gasket3.c . Features:
    1. 3D.
    2. Spec colors in an array.
    3. Reshape callback. It handles rectangular windows, keeping the tetrahedra undistorted, with the same aspect ratio, centered in the window.. Portrait and landscape mode are separate cases.
    4. glPostRedisplay

Reading: Angel, chapter 2, excluding 2.11

  1. In Homework 2, the nonphysical aspect of the graphics pipeline is the idea that objects do not interact with each other, i.e., that object A's brightness/color/etc is not affected by object B. Therefore, OK to hand in homework 2 tomorrow.
  2. Homework 3 available, due Sep 16.
  3. Prof Roysam is looking for graphics students in various roles from undergrad projects on up. See his website and talk to him. Working for him would make a good term project for this course.
8 Wed Sep 10

Topics: Chance to talk to Jixu.

9 Fri Sep 12


  1. AngelCG07.ppt: Input and interaction
  2. Demo, discuss, and modify paint.c . Features:
    1. keyboard callback
      1. write the key at a position stored in a global and update that
    2. mouse callback
    3. accumulating info, such as triangle vertices, from successive callbacks
    4. converting coords from what is passed to mouse callback (origin is top left corner) to what is used by openGL window (origin is bottom left corner)
    5. picking a region of window by analyzing coords of mouse click.
    6. immediate mode: on redisplay, if it's not explicitly redrawn, it's not there any more.
    7. colors as unsigned bytes.
    8. using globals to pass data to/from callback routines.
    9. menus
      1. create
      2. add entry
      3. add submenu
      4. attach to mouse button
    10. menu callback
      1. arg is the int key associated with that menu entry
    11. pushing and popping attributes
    12. writing text
      1. setting position
      2. writing char
      3. updating position by width of char


  1. The Provost has cancelled class on Oct 3.
  2. Good news: Profs Barb Cutler (CS), Tom Zimmie (Civil), and I just won a National Science Foundation Cyber-Enabled Discovery and Innovation award for $670K, Fundamental Terrain Representations and Operations, which, "unifies the fields of computational geometry, computer graphics, and civil engineering hydrology, resulting in a transformational ability to predict how erosion occurs, specifically in levee failure by overtopping, and, after a failure, to reverse-simulate what happened...." Details.
  3. talk today at 3 in JEC 3117 by Shivkumar Kalyanaraman an ECSE prof on leave at Telecom Research Innovation Center (TRIC), IBM India Research Laboratory, Delhi ''Spoken Web: Towards a Telco-hosted Voice-based Web created from Ordinary Cell Phones''. I'll end class a few minutes early so people can attend this.
10 Tues Sep 16


  1. passivemotion.c. Changes the image depending on where the mouse is, using a mouse passive motion callback. This shows how to answer Friday's question about causing something to happen when you mouse over a menu at the top of the window
  2. passivemotion2.c. Extends passivemotion to redraw only when something changes. This prevents the image tearing caused by redrawing during the refresh. It's also more efficient.
  3. single_double.c. Shows:
    1. The difference between single and double buffering.
    2. Creating two graphics windows in one program. Note the order:
      1. Set the display mode.
      2. Create the window.
      3. Register the callbacks.
      4. Repeat for each window.
      5. Call MainLoop.
    3. Mouse input.
    4. Changing the idle callback. The new one replaces the previous one.
  4. getinfo.c. Shows how to read information about the OpenGL version and how to get internal state variables. This also shows how to access command line arguments. This shows just a sample; there are more.
  5. showinput.c. Shows how to get input. This also shows the coordinate system used to report mouse events. Units are pixels.
       (0,0) ...... (xmax,0)
  6. Beyond double buffering: How to avoid tearing caused by swapping the foreground and background buffers in the middle of refreshing the image and the two buffers have different images?
    1. One solution is to wait until the vertical retrace to swap the buffers. However, if each buffer takes about 1/60 second to recompute, sometimes more and other times less, then the refresh rate will fluctuate between 1/60 and 2/60 second.
    2. Another solution is to use 3 buffers. You display from the 1st, have the 2nd ready to swap with the 1st in the next vertical retrace, and meanwhile compute into the 3rd. This uses 50% more memory.
    3. How to fight tearing
    4. OpenGL Extension WGL_I3D_swap_frame_lock
    5. Smooth Gaming with Triple Buffering
  7. AngelCG08.ppt more on callbacks

Reading: Angel, chapter 3.

  1. Homework 4 available, due Sep 23.
11 Wed Sep 17

Topics: chance to talk to Jixu

12 Fri Sep 19


  1. time.c. Times how quickly a frame with a square can be drawn.
  2. square2.c. Demonstrates glutMotionFunc callback. Change glutMotionFunc to glutPassiveMotionFunc to see what happens.
  3. manywindows.c. Shows that many top level windows (a new one with each left mouse click) can be dynamically created.
  4. paintxor.c modified by paint.c to write triangles into the color buffer in XOR mode. Everything else is still written in COPY mode. XOR mode is useful for cursors and rubberbanding because XORing the same object twice restores the original buffer.
  5. AngelCG09.ppt Better interactive programs
  6. AngelCG10.ppt Geometry

Announcements: By popular requests, homeworks will henceforth be due on Fridays.

13 Tues Sep 23

Topics: I will present transformations 3 different ways to help you understand this important topic.

  1. AngelCG11.ppt Representation
  2. AngelCG12.ppt Transformations
  3. My note on homogeneous coordinates and projections demoed by Albrecht Durer
    (The following display better in Firefox than Internet Explorer.)
  4. Homogeneous matrix examples, p' = M p for
    1. Translate by (1,2,3):
      {$M = \left(\begin{array}{cccc} 1 & 0 & 0 & 1\\ 0 & 1 & 0 & 2\\ 0 & 0 & 1 & 3\\ 0 & 0 & 0 & 1\end{array} \right)$} . This also works: {$M = \left(\begin{array}{cccc} 2 & 0 & 0 & 2 \\ 0 & 2 & 0 & 4 \\ 0 & 0 & 2 & 6 \\ 0 & 0 & 0 & 2 \end{array} \right)$}
    2. Rotate around Z axis by an angle whose cosine is 0.6:
      {$$ M = \left(\begin{array}{cccc} .6 & -.8 & 0 & 0 \\ .8 & .6 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array} \right)$$}


  1. Tomorrow, go to Tiemann's talk.
  2. The final exam has been set for Fri Dec 12 11:30-2:30.
14 Wed Sep 24

Topics: Michael Tiemann, Red Hat, Exonovation--Leveraging Innovation from the Edge, DCC324

15 Fri Sep 26


  1. My note on 3D rotation
    1. all rigid transformations in 3D that don't move the origin have a line of fixed points, i.e., an axis, that they rotate around.
    2. deriving the vector formula for a rotation given the axis and angle
    3. computing the matrix from a rotation axis and angle
    4. testing whether a matrix is a rotation
    5. if it is, then finding the axis and angle
  2. Bill Jacobs' OpenGL video tutorial - excellent


  1. The display list question from homework 4 is postponed until the next homework.
  2. Next Wed, go to the Network-Centric Data Acquisition talk
16 Tues Sep 30


  1. My note on homogeneous coordinates and projections demoedby Albrecht Durer in more detail.
  2. My note on 3D rotation in more detail


  1. Homework 3 solution online.
  2. Dreamworks is visiting RPI around Nov 4-5, to give a talk and interview students. If interested, contact the CDC.
17 Wed Oct 1

Topics: special talk, Dr. Gavin Pearson, Ministry of Defense in the UK, The Coming Transformation of Network-Centric DataAcquisition: Concept, Technologies, Benefits andChallenges, Lally 102

18 Fri Oct 3 Class cancelled on 9/9 by Provost.
19 Tues Oct 7

Topics: Review for midterm exam

  1. What do you think of my replacing my lectures with pointers to distinguished external speakers, such as on open SW?
  2. Do you want to use calculators in tomorrow's exam?
  3. I'm working to set up a behind-the-scenes tour of EMPAC. The video and audio capabilities are incredible.
20 Wed Oct 8

Topics: Midterm exam

  1. Calculators, and any books, papers, and notes are allowed. Computers (above the level of calculators), communication tools, and sharing material with other students are not allowed.
  2. DreamWorks Animation will be coming to campus on Friday, February 29th. They are very interested in interviewing seniors in EMAC, EART and CSCI for a variety of full-time positions (Effects Animators, Effects Developers, Crowd Simulation Animators, Character FX Animators, Technical Directors). The RedHawk JobLink Job ID is 691510 for the full-time position, and #691536 for summer internships (use job ID in Keyword field). Resume submission ends on February 19th. ... DreamWorks's URL is: http://www.dreamworksanimation.com. DreamWorks will be making a presentation that is open to all students on Friday, 02/29 at 4:00 PM in Sage 3303. (More info is available.)
  3. Homework Solution4.pdf online.
21 Fri Oct 10


  1. displaylist.c - sample display list program.
  2. AngelCG13.ppt OpenGL transformations
    # Note that the last transformation catenated onto
      the current matrix is the first transformation
      applied to the object.
  1. (Unless I hear objections) I'll defer quaternions until later (if there's time).
  #   More info is in chapter 4.
  1. AngelCG14.ppt Model Building
    1. This topic becomes ever more important as your models get bigger.
    2. The goal is to store large models in a more organized way, and then render them with fewer function calls.
    3. We start to see the separation of geometry from topology.
    4. A goal is to represent one piece of info, such as a vertex location, only once.
    5. Another goal is to store things that change more often (geometry), separately from things that don't (topology).
  2. AngelCG15.ppt Classical viewing
    This is largely obsolete. However you should recognize the terms. Vanishing points is useful for drawing perspective objects by hand.
  3. AngelCG16.ppt Computer viewing
    1. There are utility routines to help specify the camera and projection.
    2. The big idea is view normalization or projection normalization. We want to view the object with our desired perspective projection. To do this, we transform the object into another object that looks like an amusement park fun house (all the angles and lengths are distorted). However, the default parallel projection of this normalized object gives exactly the same result as our desired perspective projection of the original object. Therefore, we can always clip against a 2x2x2 cube, and project thus: (x,y,z)->(x,y,0) etc.
      More info is in Angel, page 270 and the next slide set.

Reading: Chapter 5.

  1. Homework 5 online.
23 Wed Oct 15

regular lecture.

  1. AngelCG17.ppt Projection matrices
  2. AngelCG18.ppt Shading I
    1. The big idea is the Phong shading model.
  3. AngelCG19.ppt Shading II
    1. We start to get into OpenGL specifics.


24 Fri Oct 17


  1. AngelCG20.ppt Shading in OpenGL


25 Tues Oct 21


  1. cubeview.c. Shows smooth shading the faces of a cube, and rotating it. See Angel 5.10.
  2. sphere.c. Shows 3 modes of shading a sphere with different levels of accuracy.
  3. shadow.c. Shows how to create a shadow onto a flat surface by projecting the object onto that surface. See Angel 5.10.
  4. tutors_src.zip. Nate Robbins's light tutorial.

# Angel 5.10, 6.
Tomorrow is a regular lecture.

26 Wed Oct 22

Topics: Today is a regular lecture.

  1. Computer graphics in the real world
    1. Forma Urbis Romae - reconstruction of a street map of 211AD Rome from 1186 pieces like this one:
  2. Another OpenGL tutorial The Practical Physicist's OpenGL tutorial Edward S. Boyden
  3. Steve Baker's notes on some graphics topics:
    2. basic OpenGL lighting
    3. Euler angles are evil
    4. Smooth Shading 'Gotcha's in OpenGL
  4. AngelCG21.ppt Implementation I - Rasterization, Clipping

We now change from learning the API to studying how things are implemented under the API.

  1. Advantage of using Cohen-Sutherland line clipping.
    1. You still have to include the code for the detailed clipping since sometimes the CS algorithm reports that it doesn't know.
    2. However often it can classify the line segment (or the box with everything inside) as either completely in or else completely out.
    3. In that case, the rest of the pipeline is faster.
    4. However you have to write more lines of code.
    5. You don't have to know how this works, only what its purpose is.
  2. AngelCG22.ppt Implementation II - Clipping, Visibility


27 Fri Oct 24


  1. Properties of the various visibility methods:
    1. Painters:
      1. Sorting the faces is hard and maybe impossible. Then you must split some faces.
      2. However sometimes some objects are always in front of some other objects. Then you can render the background before the foreground.
    2. Z-buffer:
      1. Subpixel objects randomly appear and disappear (aliasing).
      2. Artifacts occur when objects are closer than their Z-extent across one pixel.
      3. This happens on the edge where two faces meet.
    3. BSP tree:
      1. In 3D, many faces must be split to build the tree.
  2. Bresenham presents the fast line and circle drawing algorithms better than the text.
  3. For more info on testing whether a point is in a polygon, see my note. Also see the comp.graphics.algorithms FAQ, question 2.03.
  4. The flood fill will fail if the interior is not connected. That happens when two close edges cause adjacent pixels to be set. It will also fail if there is a gap in the perimeter - the color will leak out.
  5. The scan line fill must handle special cases like a vertex being on a scan line. My solution is to pretend that any vertex on a scan line is really slightly above. This is a simple case of a serious technique called ''Simulation of Simplicity'' invented by Herbert Edelsbrunner.
  6. One problem with interpolating color inside a polygon is that you may be creating successive frames of a video. Then, the color must be consistent from frame to frame even as the object is moving.
    E.g. if a quadrilateral rotates, it may be triangulated differently depending on its orientation. The two different triangulations may get shaded differently.
  7. Anti-aliasing is a big and important topic.

Announcements: Term project proposal due, containing:

  1. title,
  2. team members (name, email, RIN),
  3. 100 word summary.

Email to TA Jixu Chen, chenjFOUR ATrpiDOTedu

28 Tues Oct 28


  1. Bresenham circle algorithm.
  2. AngelCG23.ppt Implementation III, ctd

Reading: chapter 7.

29 Wed Oct 29

Topics: regular lecture.

  1. AngelCG24.ppt Buffers
  2. OpenGL and images:
    1. Following the less is more design philosophy, OpenGL has no facilities for reading and writing image data to disk. It does let you bitblt data between its buffers and your arrays. Otherwise, use your choice of tools.
    2. Netpbm is a large set of standalone command line programs for processing and converting image files.
      These programs follow the Unix pipe metaphor, and can be chained together.
    3. Imagemagick is another large set of standalone command-line programs for mogrifying images.
    4. You can run any standalone program from inside your C program with the system call. The only way to get info back and forth between that program and your program is via a file. It is dangerous to run system with an argument partly supplied by the user unless you thoroughly check for metachars. That, in a slightly different context, is the flaw exploited by the SQL injection attack on RFID tags.
    5. xv is a nice interactive shareware program, which I used in class today. I actually bought 2 licenses years ago.
    6. PPM (portable pixmap) is a file format that is so simple you can easily write programs to read or write it. Its files are big, but you can use one of the other above systems to convert. I showed this in class, and Angel's slides also do.

Reading: chapter 8.

Fri Oct 31

No class; prof running Fall Workshop in Computational Geometry at RPI

Tues Nov 4


  1. No class today, prof and students presenting 3 papers at 16th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM GIS 2008)
  2. On Nov 12, Dreamworks will give 2 talks, one at the same time as our lab.
30 Wed Nov 5

Topics: chance to talk to Jixu

Fri Nov 7

No class, prof and students presenting 3 papers at
16th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM GIS 2008)
Announcements: progress report due; email to TA Jixu Chen, chenjFOUR ATrpiDOTedu.

31 Tues Nov 11


  1. AngelCG25.ppt Texture mapping
    The hard problems with texture mapping are:
    1. Determining what texel in the texture map corresponds to each pixel in the frame buffer. The involves inverting some complicated mappings.
    2. That the pixel in the frame buffer is rarely the same size as the corresponding texel, but may be much larger or smaller. That varies with the distance of the object from the camera. Solutions include various smoothing techniques, and using a hierarchy of texture maps of different resolutions.
  2. AngelCG26.ppt OpenGL Texture mapping


  1. Erin Glasheen specifically welcomes ECSE-4750 students to the morning Dreamworks talk (as well as the afternoon one). BTW, not many students signed up for job interviews or internships. ?!!
  2. Next Wed at 4pm, Harry Lewis, former Dean of Harvard College will talk about his new book, Blown to Bits, about privacy in the digital age. CC324.
  3. On Dec 4 at 3pm, Mark M. Little '82, Ph.D., Senior Vice President and Director of GE Global Research will talk in the Biotech Auditorium. Little shows that it is possible to survive RPI (and prosper). Reasons to attend talks like this is include to see how he talks and what he thinks is important.
32 Wed Nov 12

Topics: No lab because:

  1. 10:30am Dreamworks talk Sage 4101
  2. 4pm Dreamworks talk Sage 3303.


33 Fri Nov 14


  1. tutors_src.zip. Nate Robbins's tutorials (ctd).
    1. fog
    2. texture
  2. http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06 another nice and very detailed texture programming tutorial, from Neon Helium productions
  3. OpenGL_Tutorial_Framework:Texture_Mapping
  4. AngelCG27.ppt Compositing and blending
  5. AngelCG28.ppt Programmable pipelines


34 Tues Nov 18

Topics: (We'll do these in more detail in the spring.)

  1. AngelCG28.ppt Programmable pipelines
  2. AngelCG29.ppt GLSL I
  3. AngelCG30.ppt GLSL II


  1. On Fri, go to the Lenovo talk.
  2. Sign up with Jixu for a 5-minute presentation of your project on Dec 2 or 3.
  3. Lockheed Martin has summer internships available. See Pat Rickert.
35 Wed Nov 19

Topics: Harry Lewis DCC324

36 Fri Nov 21

Topics: On Friday 11/21 Marc Cohen, a Lenovo executive, will be on campus and will give a presentation at 2pm in Ricketts 203.

The talk is titled ''Designing Exceptionally Engineered Notebooks''. It will cover Lenovo's approach for defining and designing ThinkPad notebooks. The acclaimed X300 and the newly announced W700 mobile workstation will be used as examples. Mark will also give a view of where technology is headed and what to expect in notebooks over the next several years. The talk will give an interesting window into how a successful company conceives and introduces products. There will also be time for questions and answers on subjects ranging from technology and notebook design to the role of an engineer and value of a business degree in a technology company.

Lenovo's Mark Cohen is a Distinguished Engineer and Vice President in the Notebook Business Unit. He is responsible for managing Lenovo's ThinkPad portfolio of products. His responsibilities include product definition and managing the development process. Mark has a strong engineering background and has just completed an MBA program to round out his educational background.
Announcements: progress report due; email to TA Jixu Chen, chenjFOUR ATrpiDOTedu.

37 Tues Nov 25


  1. Vertex and fragment shaders from chapter 17 of the OpenGL SuperBible.
  2. AngelCG39.ppt Curves and surfaces in OpenGL


  1. Here is an interesting new book: OpenGLĀ® ES 2.0 Programming Guide by Aaftab Munshi, Dan Ginsburg, Dave Shreiner. Should I move the course this way in the future?
  2. If you got value from this course, please fill out your course surveys (and say nice things if appropriate). This makes the department head like me and continue to let me teach it. I like this topic, spent a lot of time of it, and hope you liked the result.
  3. If you haven't given a preference to Jixu for which day next week you'd like to present your 5 minute fast forward talk on your project, he will assign a day.
Tues Dec 2

Topics: Five minute term project presentations. Schedule

Wed Dec 3

Topics: Five minute term project presentations.

Fri Dec 5

Topics: review for final exam

Tues Dec 9

Topics: 2pm: office hours by Chen in Lally 104

Wed Dec 10

Topics: 4pm: office hours by Chen in Science 2C14 (not 2C22)

Fri Dec 12

Topics: Final exam. 11:30-2:30, Sage 3510.

Google calendar

This is only a summary that I created so you can merge it with your other Google calendars. The details are above.

(:GoogleCalendar calendar=ir5r3mej2tpnen9blvo50uhmfc@group.calendar.google.com title="RPI ECSE-4750 Fall 2008" :)