[PR #893] [CLOSED] Add ModernGL #802

Closed
opened 2025-11-06 13:02:57 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vinta/awesome-python/pull/893
Author: @szabolcsdombi
Created: 6/4/2017
Status: Closed

Base: masterHead: moderngl


📝 Commits (1)

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 README.md (+1 -0)

📄 Description

What is this Python project?

ModernGL is a python3 module that encapsulates OpenGL in a pythonic way

Features:

  • Full linting support - (using vscode and pylint)
  • Create GLSL shaders with only a few lines of code
  • Create framebuffers and validate them with a single call
  • Access cool OpenGL features by writing clean and self-explaining code
  • vscode snippets for fast prototyping
  • Render to pillow image - (no window required)

What's the difference between this Python project and similar ones?

ModernGL - PyOpenGL

Pros

  • Same quality and performance with less code written
  • Readable code and no ctypes required
  • Rendering without a window
  • Fully linted

Cons

  • One can mix ModernGL and PyOpenGL so there are no drawbacks.

Example

Using PyOpenGL

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

vbo1 = ctx.buffer(b'Hello World!')
vbo2 = ctx.buffer(reserve=1024, dynamic=True)

Some cool features

# Read the content
>>> vbo1.read()
b'Hello World!'

# Copy between buffers
>>> ctx.copy_buffer(vbo2, vbo1)

>>> vbo2.read(5)
b'Hello'

# Buffer re-specification
>>> vbo2.orphan()
>>> vbo2.write(b'Some other data')

--

Anyone who agrees with this pull request could vote for it by adding a 👍 to it, and usually, the maintainer will merge it when votes reach 20.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vinta/awesome-python/pull/893 **Author:** [@szabolcsdombi](https://github.com/szabolcsdombi) **Created:** 6/4/2017 **Status:** ❌ Closed **Base:** `master` ← **Head:** `moderngl` --- ### 📝 Commits (1) - [`e2039b3`](https://github.com/vinta/awesome-python/commit/e2039b36c2a54f9d2ab01dc0ecda70c3ba507d12) Update README.md ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) </details> ### 📄 Description ## What is this Python project? [ModernGL](https://github.com/cprogrammer1994/ModernGL) is a python3 module that encapsulates **OpenGL** in a **pythonic** way - [ModernGL on PyPI](https://pypi.python.org/pypi/ModernGL/) - [Documentation](https://moderngl.readthedocs.io/) - [Examples](https://github.com/cprogrammer1994/ModernGL/tree/master/examples) - [Changelog](https://github.com/cprogrammer1994/ModernGL/blob/master/CHANGELOG.md) Features: - Full linting support - (using [vscode](https://code.visualstudio.com/) and [pylint](https://www.pylint.org/)) - Create GLSL shaders with only a few lines of code - Create framebuffers and validate them with a single call - Access cool OpenGL features by writing clean and self-explaining code - [vscode snippets](https://github.com/cprogrammer1994/ModernGL/blob/master/extras/vscode/python.json) for fast prototyping - Render to pillow image - (no window required) ## What's the difference between this Python project and similar ones? ### ModernGL - PyOpenGL #### Pros - Same quality and performance with less code written - Readable code and no `ctypes` required - Rendering without a window - Fully linted #### Cons - One can mix ModernGL and PyOpenGL so there are no drawbacks. ## Example ### 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) ``` ### Some cool features ```py # Read the content >>> vbo1.read() b'Hello World!' # Copy between buffers >>> ctx.copy_buffer(vbo2, vbo1) >>> vbo2.read(5) b'Hello' # Buffer re-specification >>> vbo2.orphan() >>> vbo2.write(b'Some other data') ``` -- Anyone who agrees with this pull request could vote for it by adding a :+1: to it, and usually, the maintainer will merge it when votes reach **20**. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-06 13:02:57 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-python#802