Skip to main content
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

Metadata

Release files for moderngl 5.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moderngl 5.0.7
File Size Uploaded
moderngl-5.0.7.tar.gz 99.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for moderngl 5.0.7
File
moderngl-5.0.7-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
moderngl-5.0.7-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details
moderngl-5.0.7-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
moderngl-5.0.7-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
moderngl-5.0.7-cp36-cp36m-macosx_10_6_intel.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) Details
moderngl-5.0.7-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
moderngl-5.0.7-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
moderngl-5.0.7-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
moderngl-5.0.7-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details
moderngl-5.0.7-cp35-cp35m-macosx_10_6_intel.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) Details
moderngl-5.0.7-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.0.7.tar.gz

Download URL moderngl-5.0.7.tar.gz
Size 99.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7482e402dce2a48fe9326dfedae02b279e09f4a343ecce030ed34a98f7dd7364
BLAKE2b-256 checksum
How to use checksums
bdaa1a2dafe44b4876cfb736b8c66b393f27d81f09fac51adc79be6f46536cd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp36-cp36m-win_amd64.whl

Download URL moderngl-5.0.7-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
3f41161c4cf92221a01c18772d708571190bc4f30f33bd6a250b0315d8667c7a
BLAKE2b-256 checksum
How to use checksums
88a582a18ebe404b8024eebf75c55f045c0611e99f4d7bae216c00783a9a56e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp36-cp36m-win32.whl

Download URL moderngl-5.0.7-cp36-cp36m-win32.whl
Size 89.7 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
03103e23049769d7f4ba2dc69254783c4e11b2797715830d2fca99d6f4c067a2
BLAKE2b-256 checksum
How to use checksums
2ae47f813207284bc8d4a7f92ca70147e9aa0259c37f9568d931522bcac5dbc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp36-cp36m-manylinux1_x86_64.whl

Download URL moderngl-5.0.7-cp36-cp36m-manylinux1_x86_64.whl
Size 602.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
2dd3f66e4f1e3e517b4626df5baf926cd75cdd9a3f92518e6fbc307ea639410a
BLAKE2b-256 checksum
How to use checksums
15003629bbce71e5fa6ee2c98daf64083c5dcd8748105309fb69f97e402cbc4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp36-cp36m-manylinux1_i686.whl

Download URL moderngl-5.0.7-cp36-cp36m-manylinux1_i686.whl
Size 565.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
004ad3076112d407c4b3389198c39f638fed75c47980bea6a5f74bd197243085
BLAKE2b-256 checksum
How to use checksums
7ad475176e22719188d7dd69e3b6e3e7a5b77b5154bca71cc360a9025e0f3ca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp36-cp36m-macosx_10_6_intel.whl

Download URL moderngl-5.0.7-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
be138d6fb6503649c6c0381b01523099e1a6066b52f9bfec84532d3f57567ff4
BLAKE2b-256 checksum
How to use checksums
4c92901f03d3800b1285e789a02c285ff147b1d41dddf31ddb874ce53f5a7f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp35-cp35m-win_amd64.whl

Download URL moderngl-5.0.7-cp35-cp35m-win_amd64.whl
Size 107.0 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
b01404409b9854c4c7068adb60c51a1ef28f9096f8713912e821d2200b53cb3f
BLAKE2b-256 checksum
How to use checksums
b3ab931864fdabcca4ab2edd08c755da875c4be257fa2029a55ad1a54e73c1c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp35-cp35m-win32.whl

Download URL moderngl-5.0.7-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
13bae39fca2b67734ff3789c0fcfc1b5838427aee8e158ea9d784c16fe8bedae
BLAKE2b-256 checksum
How to use checksums
c463a272389011eb2ce10902bf381cae2e184c73e90e9ec5722bd1279e615bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp35-cp35m-manylinux1_x86_64.whl

Download URL moderngl-5.0.7-cp35-cp35m-manylinux1_x86_64.whl
Size 602.4 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
0a69165a091c5f53aa2d73af01562acba40ef715808195c159032cf9602c26ee
BLAKE2b-256 checksum
How to use checksums
99046bdcf68ab93c9e6e8865fc828ae8ba3bf0a6737c5299a507063cdd314810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp35-cp35m-manylinux1_i686.whl

Download URL moderngl-5.0.7-cp35-cp35m-manylinux1_i686.whl
Size 565.3 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
de7e0906abbe31d7cd3da953105ecb45307e333431350b63f79dcb2d15564334
BLAKE2b-256 checksum
How to use checksums
66872a577b2003764e90e0dbadc015103f68b2d99f38e6ccafed8b068d1be828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp35-cp35m-macosx_10_6_intel.whl

Download URL moderngl-5.0.7-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
b3b23f70963e70785661465add0a84425b654e2bafe509f36fed6c7dbbaf77f7
BLAKE2b-256 checksum
How to use checksums
9ff7279871f373772d652e6147e6608b676d9eae94b53789e35693bc4c7e0770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / moderngl-5.0.7-cp34-cp34m-macosx_10_6_intel.whl

Download URL moderngl-5.0.7-cp34-cp34m-macosx_10_6_intel.whl
Size 219.8 kB
Tags CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
1f0a487f2c5bc73d6275c5a2a6f479590b20e23fbbb794f60916124a370373ae
BLAKE2b-256 checksum
How to use checksums
44a389dce355183070851d6e8b6842cfcfb4e0550d63f70426743b5e4bb86b53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

5.9.0

59 release files

5.8.2

50 release files

5.8.1

50 release files

5.8.0

50 release files

5.7.4

50 release files

5.7.3

50 release files

5.7.0

45 release files

5.6.4

57 release files

5.6.3

24 release files

5.5.4

19 release files

5.5.3

14 release files

5.5.2

13 release files

5.5.1

11 release files

5.4.1

14 release files

5.4.0

12 release files

5.3.0

12 release files

5.2.1

12 release files

5.2.0

12 release files

5.1.0

12 release files

This release

5.0.7 This release

12 release files

5.0.6

12 release files

5.0.5

12 release files

5.0.3

12 release files

5.0.2

12 release files

5.0.1

11 release files

5.0.0

1 release file

4.2.1

12 release files

4.2.0

8 release files

4.1.12

5 release files

4.1.9

8 release files

4.1.8

8 release files

4.1.7

8 release files

4.1.6

8 release files

4.1.4

8 release files

4.1.3

8 release files

4.1.2

8 release files

4.1.1

8 release files

4.1.0

8 release files

4.0.0

8 release files

3.1.5

8 release files

3.1.4

6 release files

3.1.3

6 release files

3.1.2

4 release files

2.4.1

30 release files

2.4.0

19 release files

2.2.1

25 release files

2.0.9

21 release files

2.0.8

8 release files

2.0.7

5 release files

2.0.6

5 release files

2.0.5

5 release files

2.0.4

5 release files

2.0.3

5 release files

2.0.2

5 release files

0.9.4

5 release files

0.9.3

5 release files

0.9.2

5 release files

0.9.1

3 release files

0.8.8

3 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

1 release file

0.8.4

2 release files

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page