OpenGL review session

  1. Introduction – why OpenGL

  2. GLUT overview

  3. OpenGL overview

  4. Rendering in OpenGL – basic 2D

  5. Rendering in OpenGL – 3D

    1. Overview of pipeline

      Viewing

      Transformation, 2 matrices
      Backface culling
      Clipping
      Depth test

      Lighting

      Diffuse, specular, ambient
      Multiple lights
      Depends on normal vectors -- glNormal

      Shading

      Based on light position, materials, normals
      Calculated for each vertex, interpolated to fill polygon (Gouraud shading)

      Transformation model

      2 matrices: projection, modelview

      glLoadIdentity

      Projection

      glOrtho, gluPerspective

      Common modelview transformations

      for viewing

      for model: glRotate, glTranslate, glScale

      General transformations: glMultMatrix

      glPushMatrix, glPopMatrix

      Rendering primitives

      Vertices, polygons, glBegin/glEnd as before

      Z buffer (hidden surface removal)

      clear depth buffer when clearing frame buffer

      glEnable (GL_DEPTH_TEST), glDepthFunc

      Texture mapping

      Enabling texture modes

      Enable texturing – glEnable (GL_TEXTURE_2D)

      Bind texture to context -- glBindTexture

      Build mipmaps – gluBuild2DMipmaps

      Set filtering options – glTexParameteri

      Specifying texture coordinates

      By hand – glTexCoord*

      Automatically -- glTexGen

  6. Performance considerations

    1. Triangle strips – good

      Vertex arrays – often good

      Display lists – sometimes good

      Texture mapping

      Mipmaps

      Hardware vs. software

  7. Gotchas

    1. Lighting

      Clipping – esp. near/far planes

      Avoid the dreaded “black screen”

       make small reversible changes to your code until you get a feel for what does what

  8. More hints

Use man pages on SGI's

man -k concept | grep ^gl

last year's review session notes

http://graphics.stanford.edu/courses/cs248-99/OpenGLSession/248opengl.html