To main page | 3dengine.org

CallLists


Call List in OpenGL is a compiled instructions.

For example you do glBegin(GL_POINTS), then you draw a million points with glVertex3f and then glEnd(). But, suppose your points location don't change much. Use call list. It's like recording a macro. Very fast and very useful for things that don't change often (like static geometry), you can use glEnables, glPushMatrix'es, etc, all is recorded (with little exceptions, like glEnableClientState's, which is basically useless in call lists).

Basically

 # create a list
 glGenLists(1, _id)
 
 # start recording (use GL_COMPILE to only record
 # or GL_COMPILE_AND_EXECUTE if you want OpenGL to
 # draw it right after recording too)
 glNewList(_id, GL_COMPILE_AND_EXECUTE)
 
 # do your stuff
 glBegin(GL_...)
 ... do actual drawing here ...
 glEnd()
 
 # end recording
 glEndList()
 
 # draw (compiled)
 glCallList(_id)
 
 # free the memory after call list no longer needed
 glDeleteLists(_id,1)
 

See also

CallList PyOpenGL Class