moderngl
ModernGL: High performance rendering for Python 3
Decision gist · record as of 2026-08-14
Yes, if you need GPU-accelerated graphics in Python and are willing to learn shader programming. ModernGL is actively maintained, has no known vulnerabilities, and significantly reduces OpenGL boilerplate. Install friction is moderate but manageable on common platforms. Not suitable if you need a higher-level graphics abstraction or cannot meet the OpenGL 3.3+ requirement.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires OpenGL 3.3 or later; some features need OpenGL 4.3.
- System must have a working OpenGL driver or use glcontext extra for headless rendering.
- Medium install friction due to compiled C++ bindings and OpenGL system dependency, but wheels are available for common platforms (macOS, Linux, Windows, multiple architectures).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute ModernGL in commercial and private projects without restriction, though you must include the license notice.
last release 2024-10-17 (666 days) · last repo commit 2026-07-11 · 2,317 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 597,880 downloads/mo, #5,835 on PyPI
Alternatives
Verify before relying
pip install moderngl
import moderngl
ctx = moderngl.get_context()
buf = ctx.buffer(b"Hello World!")
print(buf.read())- Whether pre-built wheels cover all target deployment platforms and architectures
- Performance comparison claims relative to PyOpenGL in real-world scenarios
- Specific OpenGL extension support and coverage beyond core 3.3/4.3
What it is and what it does
ModernGL is a C++-backed Python binding for OpenGL Core that abstracts away the verbose OpenGL API into a cleaner, more Pythonic interface. Instead of writing multiple OpenGL function calls to perform a single task (like creating a vertex buffer), you write one or two lines of ModernGL code. It handles GPU memory allocation, shader compilation, texture binding, and render calls with minimal ceremony.
The library is designed for graphics applications—games, scientific simulations, data visualizations, and interactive user interfaces. It supports rendering with or without a window (headless mode via glcontext), integrates naturally with NumPy arrays and Pillow images, and implements GLSL shader programming for vertex, fragment, geometry, tessellation, and compute shaders. The trade-off is that you need an OpenGL 3.3+ capable system and must understand shader programming to use it effectively.
Use it for
- Build interactive 3D scientific visualizations or simulations that need GPU acceleration without learning raw OpenGL
- Render graphics in headless environments (servers, CI/CD) where no display is available
- Create game engines or graphics demos with less boilerplate than PyOpenGL
- Process large datasets on the GPU using compute shaders for post-processing or physics simulation
- Prototype shader-based effects (lighting, particles, post-processing) quickly in Python
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need GPU-accelerated graphics in Python and are willing to learn shader programming.
ModernGL is actively maintained, has no known vulnerabilities, and significantly reduces OpenGL boilerplate. Install friction is moderate but manageable on common platforms. Not suitable if you need a higher-level graphics abstraction or cannot meet the OpenGL 3.3+ requirement.
Install
moderngl on PyPI
Before you install
Medium install friction due to compiled C++ bindings and OpenGL system dependency, but wheels are available for common platforms (macOS, Linux, Windows, multiple architectures). Maintenance is active with recent commits and stable production status.
Requires OpenGL 3.3 or later; some features need OpenGL 4.3. System must have a working OpenGL driver or use glcontext extra for headless rendering.
License in practice
MIT license is permissive; you can use, modify, and distribute ModernGL in commercial and private projects without restriction, though you must include the license notice.
Quickstart
pip install moderngl
import moderngl
ctx = moderngl.get_context()
buf = ctx.buffer(b"Hello World!")
print(buf.read())
Verify before relying
- Whether pre-built wheels cover all target deployment platforms and architectures
- Performance comparison claims relative to PyOpenGL in real-world scenarios
- Specific OpenGL extension support and coverage beyond core 3.3/4.3
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packageglcontext |
| Maintenance | Actively maintained 666 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 597,880 / month, #5,835 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableLicense :: OSI ApprovedLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyTopic :: Games/EntertainmentTopic :: Multimedia :: GraphicsTopic :: Multimedia :: Graphics :: 3D RenderingTopic :: Scientific/Engineering :: Visualization |
Evidence: moderngl-5.12.0-cp310-cp310-macosx_10_9_x86_64.whl; moderngl-5.12.0-cp310-cp310-macosx_11_0_arm64.whl; moderngl-5.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; moderngl-5.12.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; moderngl-5.12.0-cp310-cp310-musllinux_1_2_i686.whl; moderngl-5.12.0-cp310-cp310-musllinux_1_2_x86_64.whl; moderngl-5.12.0-cp310-cp310-win32.whl; moderngl-5.12.0-cp310-cp310-win_amd64.whl; moderngl-5.12.0-cp311-cp311-macosx_10_9_x86_64.whl; moderngl-5.12.0-cp311-cp311-macosx_11_0_arm64.whl; moderngl-5.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; moderngl-5.12.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; moderngl-5.12.0-cp311-cp311-musllinux_1_2_i686.whl; moderngl-5.12.0-cp311-cp311-musllinux_1_2_x86_64.whl; moderngl-5.12.0-cp311-cp311-win32.whl; moderngl-5.12.0-cp311-cp311-win_amd64.whl; moderngl-5.12.0-cp312-cp312-macosx_10_13_x86_64.whl; moderngl-5.12.0-cp312-cp312-macosx_11_0_arm64.whl; moderngl-5.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; moderngl-5.12.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “shader programming python”
- modernglModernGL is a Python wrapper over OpenGL Core that simplifies…
- panda3d-simplepbrProvides a physically-based rendering (PBR) shader pipeline for…
- dearpyguidearpygui is a GPU-accelerated GUI framework for Python that builds…
Give your agent the search over MCP, or paste the wish link into any chat.
More Graphics packages
Pillow adds image processing capabilities to Python, providing file format support, efficient pixel data handling, and image manipulation operations.
Install it if you need to work with images in Python—it is the de facto standard for this task.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Enables matplotlib figures to display inline directly within Jupyter notebooks and IPython environments instead of in separate windows.
PyMuPDF extracts, renders, converts, and manipulates PDF and other document formats (XPS, EPUB, images, Office files via Pro) with high performance, providing text, tables, images, and metadata with precise layout information.
The AGPL license requires careful review if you are building proprietary software—commercial licensing is available from Artifex.
pypdfium2 is a Python binding to PDFium that enables PDF rendering, inspection, manipulation, and creation through a ctypes interface to Google's PDFium library.
Install it if you need PDF rendering, inspection, or manipulation in Python; the medium install friction is offset by comprehensive platform support.
Altair is a declarative Python library for creating interactive statistical visualizations by writing simple, readable code that compiles to Vega-Lite specifications.
See also glcontext · moderngl-window · vispy · wgpu · PyOpenGL · PyOpenGL-accelerate · panda3d-simplepbr · comfy-angle · pyglm · Panda3D