class GL.DisplayList

The DisplayList class in the GL submodule provides a context-independent representation of an OpenGL display list. You can use a single DisplayList object with multiple GLViews and/or GLPixmaps without being concerned whether they are sharing display list spaces or not, and without having to keep track of OpenGL display list numbers.

To use a DisplayList, you provide it with a setup function that makes the necessary OpenGL calls to define the display list. Then, whenever you want to draw the display list, you call its call method. Whenever the display list is used in a context where it has not been used before, the setup function will be called to compile a representation of it for that context.

As an alternative to plugging in a setup function, you can also subclass DisplayList and override the do_setup method.

Inside your setup function or method, you can freely make calls to draw other DisplayList and Texture objects, and PyGUI will make sure that everything is done in the right order. To make this work, calls to the setup methods of those other objects are deferred until definition of the first display list has completed.

Note: If you make your own calls to glNewList and glEndList, you must not attempt to use any DisplayList or Texture objects between these calls, because PyGUI will not know that a display list is being defined, and will try to do things that don't work in that situation. Therefore it is recommended that if you use these objects, you use them for all of your display list and texure management.

Constructor

DisplayList(setup = None)
Constructs a new DisplayList with the given setup function. See the setup property.

Properties

setup
Function to define the contents of the display list. It should be a callable object of no arguments. A call to glNewList will have been made before the setup function is called, and glEndList will be called after it returns.

Methods

call()
Call the display list, using glCallList. If the display list has not previously been used with the current context (or one with which it is sharing display lists), an OpenGL display list number is allocated and the setup function is called to compile a representation of the display list.
deallocate()
Deallocates any OpenGL resources currently allocated to the DisplayList. If it is used again, new resources will be allocated.

Abstract Methods

do_setup()
As an alternative to supplying a setup function, a subclass can override this method to define the display list.
--