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.

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 Terrain & 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-test
Run a context's automated tests — the test runner behind the visual-regression suite.
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: