# Error checking

By default, pyglet calls `glGetError` after every GL function call (except where such a check would be invalid). If an error is reported, pyglet raises `GLException` with the result of `gluErrorString` as the message.

This is very handy during development, as it catches common coding errors early on. However, it has a significant impact on performance, and is disabled when python is run with the `-O` option.

You can also disable this error check by setting the following option before importing `pyglet.gl` or `pyglet.window`:

    # Disable error checking for increased performance
    pyglet.options['debug_gl'] = False

    from pyglet.gl import *

Setting the option after importing `pyglet.gl` will have no effect. Once disabled, there is no error-checking overhead in each GL call.