JMU
Display Lists in OpenGL
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Motivation
Uses of Display Lists
Steps in the Initialization Process
Steps in the Rendering Process
Naming Display Lists
Naming Display Lists (cont.)

An Example

openglexamples/displaylists/teapots.c (Fragment: name)
        
static GLuint  teapot; // For a display list
        
Creating Display Lists
Creating Display Lists (cont.)

An Example

openglexamples/displaylists/teapots.c (Fragment: create)
        
  // Create the display list
  glNewList(teapot, GL_COMPILE);
  glutSolidTeapot(0.2);
  glEndList();
        
Not Allowed in Display Lists
Executing a Display List
Executing a Display List (cont.)

An Example

openglexamples/displaylists/teapots.c (Fragment: use)
        
  // Use the display list
  for (int i = 0; i < numTeapots; i++) {
    glLoadIdentity();
    glTranslatef(deltaX[i], deltaY[0], 0.0);
    glMaterialfv(GL_FRONT, GL_SPECULAR, colorBrown);

    // Execute the display list
    glCallList(teapot);
  }
        
Hierarchical Display Lists
Executing Multiple Display Lists