The OpenGL context itself is managed by an operating-system specific library: AGL on OS X, GLX under X11 and WGL on Windows. pyglet handles these details when a window is created, but you may need to use the functions directly (for example, to use pbuffers) or an extension function.

The modules are named, and You must only import the correct module for the running operating system:

if sys.platform == 'linux2':
    from import *
elif sys.platform == 'darwin':
    from import *

There are convenience modules for querying the version and extensions of WGL and GLX named and, respectively. AGL does not have such a module, just query the version of OS X instead.

If using GLX extensions, you can import for the registered extensions or for the latest nVidia extensions.

Similarly, if using WGL extensions, import or