Name | moderngl-window JSON |
Version |
3.0.3
JSON |
| download |
home_page | None |
Summary | A cross platform helper library for ModernGL making window creation and resource loading simple |
upload_time | 2024-12-02 20:55:55 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![pypi](https://badge.fury.io/py/moderngl-window.svg)](https://pypi.python.org/pypi/moderngl-window) [![rtd](https://readthedocs.org/projects/moderngl-window/badge/?version=latest)](https://moderngl-window.readthedocs.io)
# moderngl-window
A cross platform utility library for [ModernGL](https://github.com/moderngl/moderngl) making window
creation and resource loading simple. It can also be used with PyOpenGL for
rendering with the programmable pipeline.
* [moderngl-window Documentation](https://moderngl-window.readthedocs.io)
* [moderngl-window on PyPI](https://pypi.org/project/moderngl-window)
* [moderngl-window on Github](https://github.com/moderngl/moderngl-window)
* [ModernGL](https://github.com/moderngl/moderngl)
* [ModernGL Discord Server](https://discord.gg/UEMtW8D)
Please report bugs or post questions/feedback on [github](https://github.com/moderngl/moderngl-window/issues).
## Features
* Cross platform support. Tested on Windows 10, Linux and Mac OS X.
This can save users a lot of time and is often more difficult than most people
imagine it to be.
* Easily create a window for ModernGL using pyglet, pygame, PySide2, GLFW, SDL2, PyQt5
or tkinter supporting a wide range of window, keyboard and mouse events.
These events are unified into a single system so your project can work with any window.
* Load 2D textures, texture arrays and cube maps using Pillow
* Load shaders as single or multiple `glsl` files
* Load objects/scenes from wavefront/obj, GLTF 2.0 or STL
* Resource finder system supporting multiple resource directories
* A highly plugable library supporting custom loaders,
resource finders and windows.
* Type hints everywhere making code completion and linting a breeze
We are not trying to force the user into using every aspect of this
library. If you have an exiting project and just need texture loading
you will be able to do this without unnecessary hurdles as long as
you provide us your `moderngl.Context`.
## Install
```bash
pip install moderngl-window
```
## Supported Platforms
* [x] Windows
* [x] Linux
* [x] Mac OS X
## Sample Usage
Simple example opening a window clearing every frame using red (color).
```py
# test.py
import moderngl_window as mglw
class Test(mglw.WindowConfig):
gl_version = (3, 3)
def on_render(self, time: float, frametime: float):
self.ctx.clear(1.0, 0.0, 0.0, 0.0)
Test.run()
```
Run the example with different window backends:
```bash
python test.py --window pyglet
python test.py --window pygame2
python test.py --window glfw
python test.py --window sdl2
python test.py --window pyside2
python test.py --window pyqt5
python test.py --window tk
```
`WindowConfig` classes are the simplest way to get started without knowing
a lot about this library. For more advanced usage see documentation
or examples.
## Setup from source
We assume the user knows how to handle virtualenvs.
```bash
# Install the package in editable mode
$ pip install -e .
# Install development requirements
$ pip install -e .[dev]
```
## Running Tests
With dev requirements installed:
```bash
python make.py test
```
## Building Docs
```bash
pip install -e .[dev]
python make.py html
```
## Contributing
Contributions are welcome regardless of experience level.
Don't hesitate submitting issues, opening partial or completed
pull requests.
### Plugins
We are interested in contributions providing new loaders, windows etc.
For these to be included in this library we require them
to work cross platforms (win10/linux/osx) and be fairly easy to set up.
If it requires more than manually downloading a pre-compiled dll
(like SDL2, GLFW etc.) it would most likely not be included,
but you are welcome to present your case if you still think it should
be included.
If you create your own repo/package containing plugins for
this library, please make an issue and we'll link back to it.
Be sure to include what platforms are supported, install
instructions, how you configure it in `moderngl-window` and
of course a clear and concise description of what exactly
your package provides.
## Citation
If you need to cite this repository in academic research:
```txt
@Online{Forselv2020,
author = {Einar Forselv},
title = {moderngl-window, a cross-platform windowing/utility library for ModernGL},
date = {2020-05-01},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/moderngl/moderngl-window}},
commit = {<insert hash if needed>}
}
```
If commit hash is required this can be found per release here:
<https://github.com/moderngl/moderngl-window/releases>
## Attributions
We can't build everything from scratch. We rely on certain packages
and resources to make this project possible.
### Windows
* pyglet (<https://github.com/pyglet/pyglet>)
* pygame (<https://github.com/pygame/pygame>)
* pyGLFW (<https://github.com/FlorianRhiem/pyGLFW>)
* PySDL2 (<https://github.com/marcusva/py-sdl2>)
* PySide2 (<https://wiki.qt.io/Qt_for_Python>)
* PyQt5 (<https://www.riverbankcomputing.com/software/pyqt/intro>)
* tkinter (<https://github.com/jonwright/pyopengltk>)
### Loaders
* Pillow (<https://python-pillow.org/>)
* pywavefront (<https://github.com/pywavefront/PyWavefront>)
* trimesh (<https://github.com/mikedh/trimesh>)
### Testing & Utility
* PyGLM (<https://github.com/Zuzu-Typ/PyGLM>)
* ruff (<https://github.com/astral-sh/ruff>)
* numpy (<https://github.com/numpy/numpy>)
* pytest (<https://docs.pytest.org/en/latest/>)
* coverage (<https://github.com/nedbat/coveragepy>)
## Resources
* NASA 3D Resources (<https://github.com/nasa/NASA-3D-Resources>)
* glTF Sample Models (<https://github.com/KhronosGroup/glTF-Sample-Models>)
## Some History
The majority of the code in this library comes from [demosys-py](https://github.com/Contraz/demosys-py) (somewhat modified).
Because `demosys-py` is a framework we decided to split out a lot useful functionality into this
library. Frameworks are a lot less appealing to users and it would be a shame to not make this
more available to the ModernGL user base.
Raw data
{
"_id": null,
"home_page": null,
"name": "moderngl-window",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Einar Forselv <eforselv@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/3c/16/de061149e35208cee45f1365019692a237046dc02fa413d07d28549c4811/moderngl_window-3.0.3.tar.gz",
"platform": null,
"description": "[![pypi](https://badge.fury.io/py/moderngl-window.svg)](https://pypi.python.org/pypi/moderngl-window) [![rtd](https://readthedocs.org/projects/moderngl-window/badge/?version=latest)](https://moderngl-window.readthedocs.io)\r\n\r\n# moderngl-window\r\n\r\nA cross platform utility library for [ModernGL](https://github.com/moderngl/moderngl) making window\r\ncreation and resource loading simple. It can also be used with PyOpenGL for\r\nrendering with the programmable pipeline.\r\n\r\n* [moderngl-window Documentation](https://moderngl-window.readthedocs.io)\r\n* [moderngl-window on PyPI](https://pypi.org/project/moderngl-window)\r\n* [moderngl-window on Github](https://github.com/moderngl/moderngl-window)\r\n* [ModernGL](https://github.com/moderngl/moderngl)\r\n* [ModernGL Discord Server](https://discord.gg/UEMtW8D)\r\n\r\nPlease report bugs or post questions/feedback on [github](https://github.com/moderngl/moderngl-window/issues).\r\n\r\n## Features\r\n\r\n* Cross platform support. Tested on Windows 10, Linux and Mac OS X.\r\n This can save users a lot of time and is often more difficult than most people\r\n imagine it to be.\r\n* Easily create a window for ModernGL using pyglet, pygame, PySide2, GLFW, SDL2, PyQt5\r\n or tkinter supporting a wide range of window, keyboard and mouse events.\r\n These events are unified into a single system so your project can work with any window.\r\n* Load 2D textures, texture arrays and cube maps using Pillow\r\n* Load shaders as single or multiple `glsl` files\r\n* Load objects/scenes from wavefront/obj, GLTF 2.0 or STL\r\n* Resource finder system supporting multiple resource directories\r\n* A highly plugable library supporting custom loaders,\r\n resource finders and windows.\r\n* Type hints everywhere making code completion and linting a breeze\r\n\r\nWe are not trying to force the user into using every aspect of this\r\nlibrary. If you have an exiting project and just need texture loading\r\nyou will be able to do this without unnecessary hurdles as long as\r\nyou provide us your `moderngl.Context`.\r\n\r\n## Install\r\n\r\n```bash\r\npip install moderngl-window\r\n```\r\n\r\n## Supported Platforms\r\n\r\n* [x] Windows\r\n* [x] Linux\r\n* [x] Mac OS X\r\n\r\n## Sample Usage\r\n\r\nSimple example opening a window clearing every frame using red (color).\r\n\r\n```py\r\n# test.py\r\nimport moderngl_window as mglw\r\n\r\nclass Test(mglw.WindowConfig):\r\n gl_version = (3, 3)\r\n\r\n def on_render(self, time: float, frametime: float):\r\n self.ctx.clear(1.0, 0.0, 0.0, 0.0)\r\n\r\nTest.run()\r\n```\r\n\r\nRun the example with different window backends:\r\n\r\n```bash\r\npython test.py --window pyglet\r\npython test.py --window pygame2\r\npython test.py --window glfw\r\npython test.py --window sdl2\r\npython test.py --window pyside2\r\npython test.py --window pyqt5\r\npython test.py --window tk\r\n```\r\n\r\n`WindowConfig` classes are the simplest way to get started without knowing\r\na lot about this library. For more advanced usage see documentation\r\nor examples.\r\n\r\n## Setup from source\r\n\r\nWe assume the user knows how to handle virtualenvs.\r\n\r\n```bash\r\n# Install the package in editable mode\r\n$ pip install -e .\r\n\r\n# Install development requirements\r\n$ pip install -e .[dev]\r\n```\r\n\r\n## Running Tests\r\n\r\nWith dev requirements installed:\r\n\r\n```bash\r\npython make.py test\r\n```\r\n\r\n## Building Docs\r\n\r\n```bash\r\npip install -e .[dev]\r\npython make.py html\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome regardless of experience level.\r\nDon't hesitate submitting issues, opening partial or completed\r\npull requests.\r\n\r\n### Plugins\r\n\r\nWe are interested in contributions providing new loaders, windows etc.\r\nFor these to be included in this library we require them\r\nto work cross platforms (win10/linux/osx) and be fairly easy to set up.\r\n\r\nIf it requires more than manually downloading a pre-compiled dll\r\n(like SDL2, GLFW etc.) it would most likely not be included,\r\nbut you are welcome to present your case if you still think it should\r\nbe included.\r\n\r\nIf you create your own repo/package containing plugins for\r\nthis library, please make an issue and we'll link back to it.\r\nBe sure to include what platforms are supported, install\r\ninstructions, how you configure it in `moderngl-window` and\r\nof course a clear and concise description of what exactly\r\nyour package provides.\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{Forselv2020,\r\n author = {Einar Forselv},\r\n title = {moderngl-window, a cross-platform windowing/utility library for ModernGL},\r\n date = {2020-05-01},\r\n publisher = {GitHub},\r\n journal = {GitHub repository},\r\n howpublished = {\\url{https://github.com/moderngl/moderngl-window}},\r\n commit = {<insert hash if needed>}\r\n}\r\n```\r\n\r\nIf commit hash is required this can be found per release here:\r\n<https://github.com/moderngl/moderngl-window/releases>\r\n\r\n## Attributions\r\n\r\nWe can't build everything from scratch. We rely on certain packages\r\nand resources to make this project possible.\r\n\r\n### Windows\r\n\r\n* pyglet (<https://github.com/pyglet/pyglet>)\r\n* pygame (<https://github.com/pygame/pygame>)\r\n* pyGLFW (<https://github.com/FlorianRhiem/pyGLFW>)\r\n* PySDL2 (<https://github.com/marcusva/py-sdl2>)\r\n* PySide2 (<https://wiki.qt.io/Qt_for_Python>)\r\n* PyQt5 (<https://www.riverbankcomputing.com/software/pyqt/intro>)\r\n* tkinter (<https://github.com/jonwright/pyopengltk>)\r\n\r\n### Loaders\r\n\r\n* Pillow (<https://python-pillow.org/>)\r\n* pywavefront (<https://github.com/pywavefront/PyWavefront>)\r\n* trimesh (<https://github.com/mikedh/trimesh>)\r\n\r\n### Testing & Utility\r\n\r\n* PyGLM (<https://github.com/Zuzu-Typ/PyGLM>)\r\n* ruff (<https://github.com/astral-sh/ruff>)\r\n* numpy (<https://github.com/numpy/numpy>)\r\n* pytest (<https://docs.pytest.org/en/latest/>)\r\n* coverage (<https://github.com/nedbat/coveragepy>)\r\n\r\n## Resources\r\n\r\n* NASA 3D Resources (<https://github.com/nasa/NASA-3D-Resources>)\r\n* glTF Sample Models (<https://github.com/KhronosGroup/glTF-Sample-Models>)\r\n\r\n## Some History\r\n\r\nThe majority of the code in this library comes from [demosys-py](https://github.com/Contraz/demosys-py) (somewhat modified).\r\nBecause `demosys-py` is a framework we decided to split out a lot useful functionality into this\r\nlibrary. Frameworks are a lot less appealing to users and it would be a shame to not make this\r\nmore available to the ModernGL user base.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A cross platform helper library for ModernGL making window creation and resource loading simple",
"version": "3.0.3",
"project_urls": {
"Documentation": "https://moderngl-window.readthedocs.io",
"ModernGL": "https://github.com/moderngl/moderngl",
"Source": "https://github.com/moderngl/moderngl_window"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5a3689ff8b3d84ea796c582fd66a7a00cc7c28e1b52998b84e38d5368463b528",
"md5": "322dc3a3f6bd0f7295c3f5f52570f1e1",
"sha256": "897d7b3b489824b352218561514979e78c4069172a73e42386f7f22db51029da"
},
"downloads": -1,
"filename": "moderngl_window-3.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "322dc3a3f6bd0f7295c3f5f52570f1e1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 381727,
"upload_time": "2024-12-02T20:55:53",
"upload_time_iso_8601": "2024-12-02T20:55:53.525155Z",
"url": "https://files.pythonhosted.org/packages/5a/36/89ff8b3d84ea796c582fd66a7a00cc7c28e1b52998b84e38d5368463b528/moderngl_window-3.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3c16de061149e35208cee45f1365019692a237046dc02fa413d07d28549c4811",
"md5": "054adcbc2d2a11104115049abfe46ee8",
"sha256": "b6108c2396cc54d444c11d7fc77a4db0c2c9a4d74c438ab75ea0ea61949b3143"
},
"downloads": -1,
"filename": "moderngl_window-3.0.3.tar.gz",
"has_sig": false,
"md5_digest": "054adcbc2d2a11104115049abfe46ee8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 352522,
"upload_time": "2024-12-02T20:55:55",
"upload_time_iso_8601": "2024-12-02T20:55:55.088786Z",
"url": "https://files.pythonhosted.org/packages/3c/16/de061149e35208cee45f1365019692a237046dc02fa413d07d28549c4811/moderngl_window-3.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 20:55:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "moderngl",
"github_project": "moderngl",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "moderngl-window"
}