OpenGLContext Documentation

This document collects OpenGLContext-specific documentation.  The main PyOpenGL documentation collection includes links to both PyOpenGL and OpenGL documentation which will be of use to the OpenGLContext programmer as well.

These are Khronos glTF sample models drawn by the PBR pass. Each is a render the regression suite compares against, so what is on this page is what the engine is held to. Loading glTF covers the format and what of it is supported; physically based rendering covers the material model these exercise. Every model is credited in ATTRIBUTION.md.

Installation

OpenGLContext needs Python 3.10 or newer. Install it and its core dependencies (NumPy, PyOpenGL, Pillow, PyVRML97, TTFQuery, SimpleParse, PyDispatcher, pygltflib, omi_audio and omi_physics) from PyPI:

pip install OpenGLContext

Optional extras pull in the pieces you need for particular features:

Using uv

uv resolves and installs the whole dependency set (including SimpleParse, PyVRML97 and TTFQuery) from PyPI. In a checkout:

uv venv
uv pip install -e ".[glfw,gltf]"

or, to run a script without managing a virtual environment yourself:

uv run --with "OpenGLContext[glfw,gltf]" oglc-view model.glb

Console commands

Installing the package puts these on your path:

oglc-view
The viewer — open and walk around a glTF, VRML97, OBJ or 3D Tiles scene. The format is chosen from the source, so one command opens all four. See The viewer.
oglc-terrain
Generate and walk a streamed terrain world: rolling hills, a river canyon, a lake and snow-capped mountains, with gravity, collision against the surface you can see, distance-LOD conifers and a translucent water surface. Takes a real heightmap with --dem, or an existing 3D Tiles tileset. See Streamed 3D Tiles.
oglc-gltf-demo
Browse the Khronos glTF sample models — a gallery of the conformance roster, each shown by its own picture, over the same viewer. See Sample Gallery.
oglc-gltf-regression
Render every glTF demo and diff it against a verified baseline, for checking that a rendering change moved only what it meant to.
oglc-ui-demo
The overlay UI, demonstrated: the settings screen, the key-binding editor, the console and a skin. See The overlay UI.
oglc-character-sheet
Every clip a rigged character plays, as one picture — a row per view and a column per moment of the cycle, with an overview sheet and an index.html over the set. A bad silhouette, a foot through the floor or an arm through the ribs shows up at a glance where scrubbing a viewer finds one at a time. Drawn through the ordinary PBR pass, so the sheet shows what a game gets. See Rigged characters.
oglc-test
Run a context's automated tests — the test runner behind the visual-regression suite.
oglc-deb
Build a Debian package for an application on the engine: the application and the Python that runs it, under /opt, with nothing for the machine to install. See Packaging an application.
oglc-lorentz
A Lorentz attractor drawn as a ten-thousand-point line set. A small standing demonstration of animated line geometry.

oglc-gltf, oglc-vrml and oglc-tiles are deprecated aliases for oglc-view, kept for one release cycle; each prints a notice and forwards. Use oglc-view in anything new.

OpenGLContext-Specific Documentation

Start with the Rendering documents if you want to understand how a frame is drawn, Supporting Features for the systems that run beside the renderer — how the player moves, what the world does, what it sounds like — and Content for loading and displaying models and worlds. The NeHe tutorial translations are a good starting point for beginning OpenGL programmers.

Sample Code (Where to Look)

The râison d'ętre (apologies for my rusty French) for OpenGLContext is to provide a platform for testing and sample code, so you'll find a lot of it lurking about in the project. In particular, in the source-code release, you can find sample code for: