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.
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:
OpenGLContext[glfw] -- the GLFW backend (recommended for
core-profile and PBR rendering)OpenGLContext[draco] -- Draco-compressed glTF geometry
(pulls in DracoPy). The glTF loader itself is
core, so the oglc-view viewer
reads .gltf/.glb out of the base installOpenGLContext[audio] -- the playback backend that reaches
a sound card. Audio is core and mixes without
it; this is what makes it audibleOpenGLContext[pygame], OpenGLContext[wx] --
the PyGame and wxPython backendsOpenGLContext[all] -- every backend, plus Draco and
audio playbackuvuv 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
Installing the package puts these on your path:
oglc-viewoglc-terrain--dem, or an existing 3D Tiles tileset. See
Terrain & 3D Tiles.oglc-gltf-demooglc-gltf-regressionoglc-ui-demooglc-testoglc-lorentzoglc-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.
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.
oglc-ui demooglc-terrain viewer,
the height-field path a
splat-textured landscape is walked by, and
exporting a city from OpenStreetMap
as a tileset to stream (3D Tiles support is
experimental)KHR_audio_emitter model: distance
curves, directional cones, equal-power panning, a fixed voice pool
with priority stealing, an underwater muffle, and silence as a
first-class backend. The engine is the standalone
omi_audio package; OpenGLContext supplies the
scenegraph nodes and the per-context engineoglc-view:
one command that opens a glTF model, a VRML97 world, an OBJ or a
streamed 3D Tiles dataset, its library of samples, its screens
and controls, embedding it as a
component and adding a formatThe 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: