glglue
The glue code which mediates between OpenGL and some GUI. Represent below pattern.
+--------+ +------------+
| GUI |--window resize--->| OpenGL |
| Window |--mouse input----->| Controller |
| |--keyboard input-->| |
| | | |
| |<-- draw ----------| |
+--------+ +------------+
Requirements
- Python 3.2
Site
minimal usage
then implement your own Controller.
Controller convention
You should implement Controller class that has follow methods.
class Controller:
def onResize(self, w: int, h: int) -> None:
''' when OpenGL window is resized. '''
pass
def onLeftDown(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onLeftUp(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onMiddleDown(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onMiddleUp(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onRightDown(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onRightUp(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onMotion(self, x: int, y: int) -> None:
''' mouse input '''
pass
def onWheel(self, d: int) -> None:
''' mouse input '''
pass
def onKeyDown(self, keycode: int) -> None:
''' keyboard input'''
pass
def onUpdate(self, d: int) -> None:
''' each frame. milliseconds '''
pass
def draw(self) -> None:
''' each frame'''
pass
implementations
Windows
glut
- require glut.dll or freeglut.dll
* SDL2
- require sdl2.dll
pip install pysdl2
PyQt5
pip install pyqt5
PySide2
pip install pyside2
History
- 20211115 1.2.0 remove PySide2 and add PySide6. fix wgl.
- 20190824 1.1.0 add PySide2
- 20190824 1.0.0 README.rst to README.md
- 20170926 0.4.4 add PySide
- 20170730 0.4.3 add PySDL2
- 20170726 0.4.2 add PyQt5
- 20160417 0.4.1 remove print. use logger
- 20160318 0.4 fix for python3. drop python2 support
- 20130113 0.3.1 fix mouse manipulation for PyQt4
- 20120127 0.3.0 add mouse manipulation
- 20120127 0.2.6 add stencil buffer for glut/wgl/sdl sample
- 20120126 0.2.5 use glutIdleFunc for glut animation
- 20120125 0.2.4 add wgl/sdl animation
- 20120124 0.2.3 add glut animation
- 20120123 0.2.2 add glut width, height parameter
- 20120119 0.2.0 python3 support
- 20120119 0.1.3 add SetFocus when mouseDown on wxglcanvas
- 20120115 0.1.2 update README. add MANIFEST.in
- 20120114 0.1.1 update README
- 20120114 0.1.0 implement wxglcanvas mouse event and keyboard event handling
- 20120113 0.0.9 fix wxglcanvas
- 20120112 0.0.8 fix lacking of README.rst
- 20111230 0.0.7 add wgl.mainloop, implement wgl mouse callback
- 20111230 0.0.4 fix SetWindowLongPtr
- 20111229 0.0.3 include glglue.sample. add wgl
maintenance
$ py -m venv .venv
$ .venv/Scripts/Activate.ps1
(.venv)$ pip install -e .
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
glglue-1.2.1.tar.gz
(64.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
glglue-1.2.1-py3-none-any.whl
(65.9 kB
view details)
File details
Details for the file glglue-1.2.1.tar.gz.
File metadata
- Download URL: glglue-1.2.1.tar.gz
- Upload date:
- Size: 64.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3832489dac593c2f13617389aa55d4fc0715cabdd6456c79ab0a2a5ce36a3dde
|
|
| MD5 |
ef210673ea836e1c9f340af17952eb61
|
|
| BLAKE2b-256 |
1182a5b29163a27ec61631b6ff81c34c11ed8924788fda476fa04cd6c881cf5b
|
File details
Details for the file glglue-1.2.1-py3-none-any.whl.
File metadata
- Download URL: glglue-1.2.1-py3-none-any.whl
- Upload date:
- Size: 65.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc84d7f03fcf204390f0724359ca576f4681e018fe39b4ce9995b89114db5ef9
|
|
| MD5 |
885f208bf987270e86ebd42ea126febe
|
|
| BLAKE2b-256 |
6cd6d2ebd786135ec1079473820efcc0194f345f70c1f71e9ee5ab55b9779d1c
|