GLU

GL Utility Library; API versions 1.0, 1.1, 1.2 and 1.3

For the most part the Python bindings of the GLU module are identical to that of the GLU specification. The first main difference is in the callback implementation of GLUnurbs, GLUquadric and GLUtesselator. Callbacks can be set with the appropriate function, for instance

def begin(type):
    print 'begin', type

tess = gluNewTess()
gluTessCallback(tess, GLU_TESS_BEGIN, begin)

except that the error callbacks GLU_TESS_ERROR, GLU_TESS_ERROR_DATA, or GLU_ERROR cannot be set. Instead a GLU.GLUerror exception is thrown on an error. The value of the exception will be a 2-tuple except when the error is a tessellation error, in which case the value will be set to (error_code, error_string, polygon_data).

Some other GLU functions can also throw a GLUerror. These are primarily functions which would normally return an error code. For instance, gluScaleImage

try:
    dataout = gluScaleImage(format, widthin, heightin, typein,
                            datain, widthout, heightout, typeout)
except GLUerror:
    pass

The last major difference between the GLU module and the GLU specification is that it also implements the variant decoration scheme as discussed previously for the GL module. This is implemented for the image functions: gluScaleImage, gluBuild1DMipmaps, gluBuild2DMipmaps, gluBuild3DMipmaps, gluBuild1DMipmapLevels, gluBuild2DMipmapLevels, and gluBuild3DMipmapLevels.