{"id":13419564,"url":"https://github.com/moderngl/moderngl","last_synced_at":"2026-10-19T08:44:46.576Z","repository":{"id":37484579,"uuid":"53077133","full_name":"moderngl/moderngl","owner":"moderngl","description":"Modern OpenGL binding for Python","archived":false,"fork":false,"pushed_at":"2026-10-07T19:04:18.000Z","size":9891,"stargazers_count":2329,"open_issues_count":61,"forks_count":241,"subscribers_count":42,"default_branch":"main","last_synced_at":"2026-10-16T06:10:34.796Z","etag":null,"topics":["graphical-applications","modern-opengl-functions","moderngl","opengl","pyopengl","pypi","python","rtdocs"],"latest_commit_sha":null,"homepage":"https://moderngl.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moderngl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"claude":null,"gemini":null,"cursor":null,"copilot":null,"dco":null,"cla":null,"disclosure":null}},"created_at":"2016-03-03T19:28:28.000Z","updated_at":"2026-10-13T23:34:10.000Z","dependencies_parsed_at":"2026-08-30T21:21:24.313Z","dependency_job_id":null,"html_url":"https://github.com/moderngl/moderngl","commit_stats":{"total_commits":2693,"total_committers":56,"mean_commits":"48.089285714285715","dds":0.2833271444485703,"last_synced_commit":"1f058c16945ab5bbfa4526cf69394ea515deb6a8"},"previous_names":[],"tags_count":79,"template":false,"template_full_name":null,"purl":"pkg:github/moderngl/moderngl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moderngl%2Fmoderngl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moderngl%2Fmoderngl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moderngl%2Fmoderngl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moderngl%2Fmoderngl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moderngl","download_url":"https://codeload.github.com/moderngl/moderngl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moderngl%2Fmoderngl/sbom","scorecard":{"id":655965,"data":{"date":"2025-08-11","repo":{"name":"github.com/moderngl/moderngl","commit":"2b94f9ec10e20ac69f83bea4e50947dee0ed0bcc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":7,"reason":"Found 12/16 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":1,"reason":"0 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/moderngl/moderngl/tests.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/release.yml:23","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T14:38:28.287Z","repository_id":37484579,"created_at":"2025-08-21T14:38:28.287Z","updated_at":"2025-08-21T14:38:28.287Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344872684,"owners_count":38352848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-19T02:00:06.414Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphical-applications","modern-opengl-functions","moderngl","opengl","pyopengl","pypi","python","rtdocs"],"created_at":"2024-07-30T22:01:17.749Z","updated_at":"2026-10-19T08:44:46.024Z","avatar_url":"https://github.com/moderngl.png","language":"Python","funding_links":[],"categories":["Python","C++"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n\r\n[![preview](https://github.com/moderngl/moderngl/assets/11232402/b314f7af-0c0a-4b7d-b4f5-857f426454ca)](#readme)\r\n\r\n\u003c/div\u003e\r\n\r\n# ModernGL\r\n\r\nModernGL is a Python wrapper over OpenGL Core. ModernGL simplifies the creation of graphics applications like scientific simulations, games or user interfaces.\r\nUsually, acquiring in-depth knowledge of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to learn and use.\r\nModernGL is capable of rendering with high performance and quality, with less code written.\r\n\r\n```\r\npip install moderngl\r\n```\r\n\r\n- [Documentation](https://moderngl.readthedocs.io/)\r\n- [Examples](https://github.com/moderngl/moderngl/tree/master/examples/#readme)\r\n- [ModernGL on Github](https://github.com/moderngl/moderngl/)\r\n- [ModernGL on PyPI](https://pypi.org/project/ModernGL/)\r\n- [ModernGL Discord Server](https://discord.gg/UEMtW8D)\r\n\r\n## Extras\r\n\r\n### [glcontext](https://github.com/moderngl/glcontext) - Headless Context Creation\r\n\r\n```\r\npip install moderngl[headless]\r\n```\r\n\r\n### [moderngl-window](https://github.com/moderngl/moderngl-window) - Window Creation and Resource Loading\r\n\r\n```\r\npip install moderngl-window\r\n```\r\n\r\n## Features\r\n\r\n- GPU accelerated high quality graphics\r\n- Rendering modern OpenGL scenes with less headache\r\n- Simpler and faster than PyOpenGL\r\n- Can render without a window\r\n- 100% Pythonic\r\n\r\n## Sample usage\r\n\r\n```py\r\n\u003e\u003e\u003e import moderngl\r\n\u003e\u003e\u003e ctx = moderngl.get_context()\r\n\u003e\u003e\u003e buf = ctx.buffer(b\"Hello World!\")  # allocated on the GPU\r\n\u003e\u003e\u003e buf.read()\r\nb'Hello World!'\r\n```\r\n\r\nFor complete examples please visit the [Examples](https://github.com/moderngl/moderngl/tree/master/examples/#readme).\r\n\r\n## Easy to use with Pillow\r\n\r\n```py\r\n\u003e\u003e\u003e img = Image.open(\"texture.jpg\").convert(\"RGB\")\r\n\u003e\u003e\u003e ctx.texture(img.size, 3, img.tobytes())\r\n\u003cTexture: 1\u003e\r\n```\r\n\r\n## Easy to use with Numpy\r\n\r\n```py\r\n\u003e\u003e\u003e ctx.buffer(np.array([0.0, 0.0, 1.0, 1.0], dtype=\"f4\"))\r\n\u003cBuffer: 1\u003e\r\n```\r\n\r\n## Compared to PyOpenGL\r\n\r\nWith PyOpenGL, using the original OpenGL API, you have to write three lines to\r\nachieve a simple task like binding a VBO:\r\n\r\n```py\r\nvbo1 = GL.glGenBuffers(1)\r\nGL.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo1)\r\nGL.glBufferData(GL.GL_ARRAY_BUFFER, b\"Hello World!\", GL.GL_STATIC_DRAW)\r\n\r\nvbo2 = GL.glGenBuffers(1)\r\nGL.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo2)\r\nGL.glBufferData(GL.GL_ARRAY_BUFFER, None, GL.GL_DYNAMIC_DRAW)\r\n```\r\n\r\nWith ModernGL you need just one simple line per VBO to achieve the same results:\r\n\r\n```py\r\nvbo1 = ctx.buffer(b\"Hello World!\")\r\nvbo2 = ctx.buffer(reserve=1024, dynamic=True)\r\n```\r\n\r\n## Development\r\n\r\n```\r\ngit clone git@github.com:moderngl/moderngl.git\r\ncd moderngl\r\npython -m pip install -e .\r\n```\r\n\r\n## Using GLSL in ModernGL\r\n\r\nGLSL (OpenGL Shading Language) is integral for shader programming using the ModernGL library. It allows developers to execute code on the GPU, enhancing graphics rendering performance. This concise introduction covers the core concepts necessary for starting with GLSL in ModernGL.\r\n\r\nData Types\r\n\r\nGLSL offers standard data types similar to C, including int, float, double, and bool, as well as graphics-specific types like vectors (vec2, vec3, vec4) and matrices (mat2, mat3, mat4) for efficient graphics computations.\r\nInputs and Outputs\r\n  ```\r\n    Attributes: Per-vertex data passed to the vertex shader. Commonly used for positions, normals, and texture coordinates.\r\n    Varyings: Interpolated data passed from the vertex to the fragment shader, such as colors or texture coordinates.\r\n    Output: Fragment shader's output, typically the color of the pixel (fragColor).\r\n  ```\r\n\r\nUniforms\r\n\r\nUniforms are global variables declared in shaders, constant for all vertices or fragments for a single draw call. They're ideal for passing data from your application, like transformation matrices or material properties, to the shader.\r\nShader Types\r\n  ```\r\n    Vertex Shader: Processes each vertex's attributes. It's the first stage in the shader pipeline, used for transformations and passing data to the fragment shader.\r\n    Fragment Shader: Calculates the color of each pixel. It uses data interpolated from the vertex shader to apply textures, lighting, and color.\r\n    Geometry Shader: Processes primitives (points, lines, triangles) formed by vertices from the vertex shader. It can add or remove vertices from the primitive.\r\n    Tessellation Shaders: Control the tessellation of patches, allowing for smoother geometries at varying distances.\r\n    Compute Shader: Handles general-purpose computing tasks not directly related to rendering images, like physics simulations or post-processing effects.\r\n  ```\r\nExample\r\n  ```\r\n  glsl\r\n  \r\n  // Vertex Shader\r\n  #version 330 core\r\n  in vec3 position;\r\n  uniform mat4 modelViewProjection;\r\n  void main() {\r\n      gl_Position = modelViewProjection * vec4(position, 1.0);\r\n  }\r\n  \r\n  // Fragment Shader\r\n  #version 330 core\r\n  out vec4 fragColor;\r\n  void main() {\r\n      fragColor = vec4(1.0); // Set pixel color to white\r\n  }\r\n  ```\r\nThis basic example demonstrates a vertex shader transforming vertex positions with a matrix and a fragment shader setting the color of each pixel to white.\r\n## Notes\r\n\r\nModernGL may be faster than other libraries providing direct OpenGL access.\r\nModernGL is implemented in C++ and a single render call involving multiple OpenGL functions count as a single Python function call.\r\n\r\nModernGL require **OpenGL 3.3**. Compute Shaders require **OpenGL 4.3**.\r\nSome functionality relies on specific extensions.\r\n\r\nModernGL can be used **anywhere where OpenGL is supported.** ModernGL is also working in a [headless](examples/headless) environment.\r\n\r\nModernGL is responsible for calling the OpenGL API and providing a Pythonic user-friendly API instead.\r\nIt is possible to integrate moderngl into any window libraries that support OpenGL.\r\nConsider [moderngl-window](https://github.com/moderngl/moderngl-window) which implements many of them, plus it also helps with resource loading.\r\n\r\nModernGL does not implement the full OpenGL feature set or extensions. You can interact with the ModernGL objects from OpenGL.\r\n\r\n## Citation\r\n\r\nIf you need to cite this repository in academic research:\r\n\r\n```txt\r\n@Online{Dombi2020,\r\n  author = {Szabolcs Dombi},\r\n  title = {ModernGL, high performance python bindings for OpenGL 3.3+},\r\n  date = {2020-05-01},\r\n  publisher = {GitHub},\r\n  journal = {GitHub repository},\r\n  howpublished = {\\url{https://github.com/moderngl/moderngl}},\r\n  commit = {\u003cinsert hash if needed\u003e}\r\n}\r\n```\r\n\r\nThe commit hash can be found in the [Releases](https://github.com/moderngl/moderngl/releases).\r\n\r\n## Community\r\n\r\n- [ModernGL Discord Server](https://discord.gg/UEMtW8D)\r\n- [Contributors](https://github.com/moderngl/moderngl/graphs/contributors)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoderngl%2Fmoderngl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoderngl%2Fmoderngl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoderngl%2Fmoderngl/lists"}