ModernGL
========
.. code-block:: 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.python.org/pypi/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
------------
.. code-block:: 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
---------------------------------
.. code-block:: py
>>> img = Image.open('texture.jpg')
>>> ctx.texture(img.size, 3, img.tobytes())
<Texture: 1>
.. code-block:: 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
~~~~~~~~~~~~~~
.. code-block:: 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
~~~~~~~~~~~~~~
.. code-block:: py
vbo1 = ctx.buffer(b'Hello World!')
vbo2 = ctx.buffer(reserve=1024, dynamic=True)
Build
-----
.. image:: https://img.shields.io/travis/cprogrammer1994/ModernGL/master.svg?label=build
:target: https://travis-ci.org/cprogrammer1994/ModernGL
:alt: build
.. image:: https://img.shields.io/appveyor/ci/cprogrammer1994/ModernGL/master.svg?label=build
:target: https://ci.appveyor.com/project/cprogrammer1994/ModernGL
:alt: build
.. code-block:: 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 <https://github.com/cprogrammer1994/ModernGL/tree/master/examples/standalone>`_ as well.
Rendering to a window only requires a valid OpenGL context.
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 <https://pypi.python.org/pypi/PyQt5/>`_\ , `pyglet <https://bitbucket.org/pyglet/pyglet/wiki/Home>`_\ ,
`pygame <https://www.pygame.org/news>`_\ , `GLUT <https://wiki.python.org/moin/PyOpenGL>`_ and many others.
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
========
.. code-block:: 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.python.org/pypi/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
------------
.. code-block:: 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
---------------------------------
.. code-block:: py
>>> img = Image.open('texture.jpg')
>>> ctx.texture(img.size, 3, img.tobytes())
<Texture: 1>
.. code-block:: 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
~~~~~~~~~~~~~~
.. code-block:: 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
~~~~~~~~~~~~~~
.. code-block:: py
vbo1 = ctx.buffer(b'Hello World!')
vbo2 = ctx.buffer(reserve=1024, dynamic=True)
Build
-----
.. image:: https://img.shields.io/travis/cprogrammer1994/ModernGL/master.svg?label=build
:target: https://travis-ci.org/cprogrammer1994/ModernGL
:alt: build
.. image:: https://img.shields.io/appveyor/ci/cprogrammer1994/ModernGL/master.svg?label=build
:target: https://ci.appveyor.com/project/cprogrammer1994/ModernGL
:alt: build
.. code-block:: 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 <https://github.com/cprogrammer1994/ModernGL/tree/master/examples/standalone>`_ as well.
Rendering to a window only requires a valid OpenGL context.
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 <https://pypi.python.org/pypi/PyQt5/>`_\ , `pyglet <https://bitbucket.org/pyglet/pyglet/wiki/Home>`_\ ,
`pygame <https://www.pygame.org/news>`_\ , `GLUT <https://wiki.python.org/moin/PyOpenGL>`_ and many others.
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
Metadata
Release files for moderngl 5.1.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 | |
|---|---|---|---|
| moderngl-5.1.0.tar.gz | 99.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| moderngl-5.1.0-cp36-cp36m-win_amd64.whl | CPython 3.6 | CPython 3.6 pymalloc | Windows x86-64 | Details |
| moderngl-5.1.0-cp36-cp36m-win32.whl | CPython 3.6 | CPython 3.6 pymalloc | Windows x86-32 | Details |
| moderngl-5.1.0-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| moderngl-5.1.0-cp36-cp36m-manylinux1_i686.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-32 | Details |
| moderngl-5.1.0-cp36-cp36m-macosx_10_6_intel.whl | CPython 3.6 | CPython 3.6 pymalloc | macOS 10.6+ Intel (x86-64, i386) | Details |
| moderngl-5.1.0-cp35-cp35m-win_amd64.whl | CPython 3.5 | CPython 3.5 pymalloc | Windows x86-64 | Details |
| moderngl-5.1.0-cp35-cp35m-win32.whl | CPython 3.5 | CPython 3.5 pymalloc | Windows x86-32 | Details |
| moderngl-5.1.0-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| moderngl-5.1.0-cp35-cp35m-manylinux1_i686.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-32 | Details |
| moderngl-5.1.0-cp35-cp35m-macosx_10_6_intel.whl | CPython 3.5 | CPython 3.5 pymalloc | macOS 10.6+ Intel (x86-64, i386) | Details |
| moderngl-5.1.0-cp34-cp34m-macosx_10_6_intel.whl | CPython 3.4 | CPython 3.4 pymalloc | macOS 10.6+ Intel (x86-64, i386) | Details |
Total release size: 3.5 MB
Release files / moderngl-5.1.0.tar.gz
| Download URL | moderngl-5.1.0.tar.gz |
|---|---|
| Size | 99.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ae60e00784ad7f225f897df6a281b66799e083a33360af7f3766e0afa63ab20
|
|
BLAKE2b-256 checksum How to use checksums |
895c8d1eed262a51a2e4b0b7868f40476e275e49ff64e9c9b0b4414ce9a59e29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp36-cp36m-win_amd64.whl
| Download URL | moderngl-5.1.0-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 102.6 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a039da60780eba15d073bbd04e1142b48fa6549bef26f93a46470654bd91c629
|
|
BLAKE2b-256 checksum How to use checksums |
4d3389001231e268f281a155aff2c708b583739b87a698964043e517c52f2534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp36-cp36m-win32.whl
| Download URL | moderngl-5.1.0-cp36-cp36m-win32.whl |
|---|---|
| Size | 89.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
d1f31d01ffb8edd22709c20635e0ee5b546f80092f6f7a31348cffcfbc140617
|
|
BLAKE2b-256 checksum How to use checksums |
b3180a637f51634661b638e25ad55a13ba9084748a18df2ade7bcb5de9cef7ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | moderngl-5.1.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 602.4 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
fb63baa22ee9a88725641968239c71d060e5500b784c9151071e3cc693a4b6f1
|
|
BLAKE2b-256 checksum How to use checksums |
ec9524005bef874f08389fdca24e647c92ed8f902ecf1bc0b081c1815faeda00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp36-cp36m-manylinux1_i686.whl
| Download URL | moderngl-5.1.0-cp36-cp36m-manylinux1_i686.whl |
|---|---|
| Size | 565.3 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
9428e7930bc63fb7aa4fb123a6a50e7f242c96fca072580ff0bc38e97e274838
|
|
BLAKE2b-256 checksum How to use checksums |
8b283b12c45d5b8e672cadcc46101ec0db6ffb61a0a122439d85ce705fa505fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | moderngl-5.1.0-cp36-cp36m-macosx_10_6_intel.whl |
|---|---|
| Size | 219.9 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
c95dce303cb1e9621e595e8bcb5c42854aeaa6b70da1c968d088296139db03e6
|
|
BLAKE2b-256 checksum How to use checksums |
e104e49218d33698b8f851167ca014a2f4c016caef1ab8cb605c996981316055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp35-cp35m-win_amd64.whl
| Download URL | moderngl-5.1.0-cp35-cp35m-win_amd64.whl |
|---|---|
| Size | 107.2 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c541a8d118ab1bed89914cb00ef00d1774f1deef888cc55392c9d8e3df659f94
|
|
BLAKE2b-256 checksum How to use checksums |
42b9bd6783bfb2681eeb1578829d3298bf049745f00cb5756deef0d4ba0400cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp35-cp35m-win32.whl
| Download URL | moderngl-5.1.0-cp35-cp35m-win32.whl |
|---|---|
| Size | 94.2 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
ec62de7f3033d2f19a4db8389cfaeeea98473ab9ab7b391d372f6c0e4cba3954
|
|
BLAKE2b-256 checksum How to use checksums |
58725fe217cb03f452f21c55255b16a1e326e1b786176d8b2a1f3bb9a448b056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | moderngl-5.1.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 602.6 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
2165b1d9390fdfaaef39d4c035abd7f72f262d4fa8e37385c86bd06b3752c9fd
|
|
BLAKE2b-256 checksum How to use checksums |
27c293ba84c87921957dafb0874b46c5b60949696e26634e2f5e7fb2e59ce445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp35-cp35m-manylinux1_i686.whl
| Download URL | moderngl-5.1.0-cp35-cp35m-manylinux1_i686.whl |
|---|---|
| Size | 565.4 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
93256db8fb3ed9402ac62d63088b72e3026deb685593d4b6ff71daf85ba553a9
|
|
BLAKE2b-256 checksum How to use checksums |
1c9773f1d59c6b9f11fb19526ebe33a588f46d10280e7ce34ce38f4b8c5e980a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | moderngl-5.1.0-cp35-cp35m-macosx_10_6_intel.whl |
|---|---|
| Size | 219.9 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
a8ed4c8924f3c2b82f5fd5f597529bc023f345c630a25701d4bf59c5d65f1c03
|
|
BLAKE2b-256 checksum How to use checksums |
97f3a15062b4c7a41d5e6bf58319884ef9025487503418176040760974dc22d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / moderngl-5.1.0-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | moderngl-5.1.0-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 219.9 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
12bf9e0d4a75e5fac0a5736bd1b13b56a009bce2591f7bc677cd836b155bfe86
|
|
BLAKE2b-256 checksum How to use checksums |
f2942e395867adb10e80b53cce33f55d735f350b38864eb92c63a62194ee9673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |