glcontext is a Python library providing portable headless OpenGL context creation, making it possible to run OpenGL applications without a display server or window. It supports various backends like standalone, EGL, OSMesa, WGL, and GLX. The current version is 3.0.0, with a release cadence tied to the moderngl ecosystem and bug fixes.
pip install glcontextVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a basic headless OpenGL context using the `create_context` function and the `standalone=True` argument. It also shows how to retrieve basic context information and correctly release resources.
Replace calls to `glcontext.headless_context()` with `glcontext.create_context(standalone=True)`.
Ensure your system has the necessary OpenGL drivers and libraries (e.g., Mesa for `osmesa`, appropriate vendor drivers for `egl`/`glx`) installed and accessible. Check `glcontext.available` for supported backends before attempting to create a context.
Always call `ctx.release()` on the `Context` object when you are finished with it to free up underlying system resources.
No dependency data recorded yet.