[](#readme)
# ModernGL
```sh
pip install ModernGL
```
- [Documentation](https://moderngl.readthedocs.io/)
- [Examples](https://github.com/cprogrammer1994/ModernGL/tree/master/examples/#readme)
- [ModernGL on Github](https://github.com/cprogrammer1994/ModernGL/)
- [ModernGL on PyPI](https://pypi.org/project/ModernGL/)
## Features
- GPU accelerated high quality graphics
- Rendering modern OpenGL scenes with less headache
- Simpler and faster than PyOpenGL
- Can render without a window
- 100% Pythonic
## Sample usage
```py
>>> import moderngl
>>> ctx = moderngl.create_standalone_context()
>>> buf = ctx.buffer(b'Hello World!') # allocated on the GPU
>>> buf.read()
b'Hello World!'
```
For complete examples please visit the [Examples](https://github.com/cprogrammer1994/ModernGL/tree/master/examples/#readme).
## Easy to use with Pillow and Numpy
```py
>>> img = Image.open('texture.jpg')
>>> ctx.texture(img.size, 3, img.tobytes())
<Texture: 1>
```
```py
>>> ctx.buffer(np.array([0.0, 0.0, 1.0, 1.0], dtype='f4'))
<Buffer: 1>
```
## Compared to PyOpenGL
With the original OpenGL API you have to write a couple of lines to achieve a **simple task** like compiling a shader or running a computation on the GPU. With ModernGL you will need just a **few lines** to achieve the same result.
#### Using PyOpenGL
```py
vbo1 = glGenBuffers(1)
GL.glBindBuffer(GL_ARRAY_BUFFER, vbo1)
GL.glBufferData(GL_ARRAY_BUFFER, b'Hello World!', GL_STATIC_DRAW)
vbo2 = glGenBuffers(1)
GL.glBindBuffer(GL_ARRAY_BUFFER, vbo2)
GL.glBufferData(GL_ARRAY_BUFFER, b'\x00' * 1024, GL_DYNAMIC_DRAW)
```
#### Using ModernGL
```py
vbo1 = ctx.buffer(b'Hello World!')
vbo2 = ctx.buffer(reserve=1024, dynamic=True)
```
## Build
[](https://travis-ci.org/cprogrammer1994/ModernGL)
[](https://ci.appveyor.com/project/cprogrammer1994/ModernGL)
```sh
python setup.py build_ext --inplace
```
## FAQ
### Is ModernGL faster than PyOpenGL?
In some cases **yes**, the core functions of ModernGL are written in C++, OpenGL functions are called in quick succession so these calls together count as a single python function call.
### What version of OpenGL is used?
Most of the calls only require **OpenGL 3.3** but Subroutines and Compute Shaders require **OpenGL 4.0** and **OpenGL 4.3**
### Is my old PC supported?
OpenGL 3.3 came out in February 2010. With **up to date drivers** you will be able to use the most of the ModernGL functions, even on integrated graphics cards. _(No, Compute Shaders won't work)_
### Where can I use ModernGL?
**Anywhere where OpenGL is supported.** ModernGL is capable of rendering using a [standalone_context] as well. Rendering to a window only requires a valid OpenGL context.
[standalone_context]: https://github.com/cprogrammer1994/ModernGL/tree/master/examples/standalone
### Can ModernGL create a Window?
**NO**, Window creation is up to you. You can choose from a large variety of modules that can create a window: [PyQt5], [pyglet], [pygame], [GLUT] and many others.
[PyQt5]: https://pypi.org/project/PyQt5/
[pyglet]: https://bitbucket.org/pyglet/pyglet/wiki/Home
[pygame]: https://www.pygame.org/news
[GLUT]: https://wiki.python.org/moin/PyOpenGL
### Limitations using ModernGL over PyOpenGL?
All the neccessary calls are (or can be) implemented in ModernGL. However you can interract with the ModernGL objects from PyOpenGL. If something is missing write an [issue](https://github.com/cprogrammer1994/ModernGL/issues) or raise a [PR](https://github.com/cprogrammer1994/ModernGL/pulls).
## Supported platforms
- [x] Windows
- [x] Linux
- [x] Mac
## Installing from source
### Installing on Ubuntu from source
```sh
apt-get install python3-dev libgl1-mesa-dev libx11-dev
python3 setup.py install
```
### Building the sphinx documentation
```sh
pip install -r docs/requirements.txt
python setup.py build_sphinx
```
### Running tests
```sh
pytest
```
> Some of the tests may be skipped when the supported OpenGL version is below the requirements of the given test.
### Headless rendering
```sh
apt-get install xvfb
alias xpy='xvfb-run -s "-screen 0 1x1x24" python3'
xpy -m ModernGL
```
## Code quality
Code is tested with [pep8], [flake8], [prospector] and [pylint]
[pep8]: https://www.python.org/dev/peps/pep-0008/
[flake8]: http://flake8.pycqa.org/en/latest/
[prospector]: https://prospector.landscape.io/en/master/
[pylint]: https://www.pylint.org/
## Community
- [Code of conduct](https://github.com/cprogrammer1994/ModernGL/blob/master/.github/CODE_OF_CONDUCT.md)
## Contributors
- [Szabolcs Dombi](https://github.com/cprogrammer1994)
- [SimLeek](https://github.com/SimLeek)
- [Aljenci](https://github.com/Aljenci)
- [MinchinWeb](https://github.com/MinchinWeb)
- [Silexstudio](https://github.com/Silexstudio)
- [stuaxo](https://github.com/stuaxo)
- [Tomi Aarnio](https://github.com/toaarnio)
- [Joshua Reibert](https://github.com/joshua-r)
and [many others](https://github.com/cprogrammer1994/ModernGL/graphs/contributors)
Thank You!
Contributions are welcome. _(Please add yourself to the list)_
Metadata
Release files for moderngl 5.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moderngl-5.2.0.tar.gz | 100.5 kB | Without provenance | Details for moderngl-5.2.0.tar.gz |
Built distributions (wheels)
Total release size: 3.5 MB
Release files / moderngl-5.2.0.tar.gz
| Download URL | moderngl-5.2.0.tar.gz |
|---|---|
| Size | 100.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adea5338c1218585fd468b77ba98844104a297baf54137db98701ff98faf4328
|
|
BLAKE2b-256 checksum How to use checksums |
cab135c7dba6639e61442a14f054e88d99ea2a1c81ac29b0992f08d4251e012c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp36-cp36m-win_amd64.whl
| Download URL | moderngl-5.2.0-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 104.1 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d95403d5f53bf3af29e3953e5ed71de7a748ad22ca401dde7a86fc84e7cec2c3
|
|
BLAKE2b-256 checksum How to use checksums |
9521051ab50afa1bb33143a1207e106d4099446ee792f247a918b0fca6977479
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp36-cp36m-win32.whl
| Download URL | moderngl-5.2.0-cp36-cp36m-win32.whl |
|---|---|
| Size | 91.2 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
beb3d8890d4a4a6a6b83dca4f117e1b96de8a9cdbdc05ef60f78aee2bb615f71
|
|
BLAKE2b-256 checksum How to use checksums |
cdf95fca27404e7f5df61bb7a8ab927309c803bdfe09ff1056b5dfea3e569f09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | moderngl-5.2.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 604.3 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
55aa4a50f734fb1fae2c7a0297a77b5aa1884b85a760dec2cb7c52c93455fe63
|
|
BLAKE2b-256 checksum How to use checksums |
ddd1b1cedd3a87c79ed4a1951c8bd4bd37418d0fb7da70f63094506ea80c5667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp36-cp36m-manylinux1_i686.whl
| Download URL | moderngl-5.2.0-cp36-cp36m-manylinux1_i686.whl |
|---|---|
| Size | 567.1 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
0fc25d5641525aabac0f8619b5a66a2b2a40705cde8860aaeae760fcd95dce14
|
|
BLAKE2b-256 checksum How to use checksums |
bcc92cbb79fb4c0d5b07d1ddedd6878b09a36b45683be8b55729eff8a965ea62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | moderngl-5.2.0-cp36-cp36m-macosx_10_6_intel.whl |
|---|---|
| Size | 221.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
eb762d26b08b2b554be846ecb031a876727d58b392a9cb91a3d5029830cc3306
|
|
BLAKE2b-256 checksum How to use checksums |
84e3893f53e03b6d7aa5f01f86242f91b30f35b79a7f5b071edc94650e50f0b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp35-cp35m-win_amd64.whl
| Download URL | moderngl-5.2.0-cp35-cp35m-win_amd64.whl |
|---|---|
| Size | 108.7 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4668707f1ce553ff2b26616dd78f6e62ff74ef4773638223cacc65a75f4f26da
|
|
BLAKE2b-256 checksum How to use checksums |
2a058ed8a61bd6952ef3949d3e48402d185ff6225a8d06695c722c74a4821e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp35-cp35m-win32.whl
| Download URL | moderngl-5.2.0-cp35-cp35m-win32.whl |
|---|---|
| Size | 95.7 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
29b12d811624d812e0efa2297abb297599a6b7ba33b66bb24395755f4b9e5e27
|
|
BLAKE2b-256 checksum How to use checksums |
8857dd1c4afe8c476f1f4a6f880d9577013c5a8e16f86669325c55b570453344
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | moderngl-5.2.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 604.5 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee5bcbb063fab205337e916aff11a6590e50a78bfec13cfa81eafc5164e62973
|
|
BLAKE2b-256 checksum How to use checksums |
0bf4920bd8d8ea6677af5df0a87d17d4ff3f211f96bb38dcfae78843b8a47702
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp35-cp35m-manylinux1_i686.whl
| Download URL | moderngl-5.2.0-cp35-cp35m-manylinux1_i686.whl |
|---|---|
| Size | 567.2 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
9451c75b3913f53e03b47ec9a61d70c057a217b7dff61394b5fb8bc4aabb17bd
|
|
BLAKE2b-256 checksum How to use checksums |
62022976bbc4e3357a8af7227c9ba131df11dfe6ab936085a3a293484ce73fbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | moderngl-5.2.0-cp35-cp35m-macosx_10_6_intel.whl |
|---|---|
| Size | 221.8 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
190753b9f399e43bf63a9e05bc085b6bb06650052103e9f75c46a5d5f976036c
|
|
BLAKE2b-256 checksum How to use checksums |
0ee953f7ff7dd22b9984dea90746ea15e49387c9305551b291b3b6802735466c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.2.0-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | moderngl-5.2.0-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 221.8 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
0385f576c70a43f237d89ef58e631c80872bcb7644993a64a0e743c0f797cdb3
|
|
BLAKE2b-256 checksum How to use checksums |
0fa4cb6480ccf32c5cc3223f5fd34de57f9b91ebc9b95dbb3e1aa170eaaed5e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for moderngl 5.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.