pyglpainter
Minimalistic, modern OpenGL drawing library for technical applications, teaching or
experimentation. It is implemented in Python 3 with Qt 5 bindings (it inherits from QOpenGLWidget).
It provides a simple Python API to draw raw OpenGL primitives (LINES, LINE_STRIP, TRIANGLES, etc.)
as well as a number of useful composite primitives
(see classes Grid, Star, CoordSystem, Text, Circle, Arc, HeightMap, OrthoLineGrid).
All objects/items can either be drawn as real 3D world entities (which optionally support "billboard" mode), or as a 2D overlay.
The user can interactively navigate using the mouse via the classical Pan-Zoom-Rotate paradigm implemented via a virtual trackball (using quaternions for rotations).
Background
This code was originally written for a CNC application, but then split off and made more general.
This library was developed to produce simple technical visualizations and minimalistic line drawings in 3D space; it does not implement a hierarchical scene graph. To be extensible, shader code has to be supplied by the application.
It uses the "modern", shader-based, OpenGL API rather than the deprecated "fixed pipeline".
Qt has been chosen not only because it provides the GL environment, but also vector, matrix and quaternion math. A port of this Python code into native Qt C++ would therefore be trivial.
Installation
pip install pyglpainter
Usage
The test directory of the source repository provides a full integration example, which can also be run for testing.
Most of the time, calls to item_create() are enough to build a 3D world with objects
in it (the name for these objects here is "items"). Items can be rendered using different shader
programs.
Mouse Navigation
Left Button drag left/right/up/down: Rotate camera left/right/up/down
Middle Button drag left/right/up/down: Move camera left/right/up/down
Wheel rotate up/down: Move camera ahead/back
Right Button drag up/down: Move camera ahead/back (same as wheel)
One particular choice was to hold the camera's field of view constant; "Zooming" can be achieved by moving the camera forward along its look axis.
Requirements
- The Python version specified in the file
.python-version - OpenGL version 2.1 (with GLSL version 1.20)
Development
Dependencies are managed using pipenv:
pip install pipenv --user
pipenv install
To run the example:
PYTHONPATH=src pipenv run python ./test/example.py
Building
pipenv run make build_deps
pipenv run make dist
Metadata
Release files for pyglpainter 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyglpainter-1.0.3.tar.gz | 66.7 kB | Without provenance | Details for pyglpainter-1.0.3.tar.gz |
Release files / pyglpainter-1.0.3.tar.gz
| Download URL | pyglpainter-1.0.3.tar.gz |
|---|---|
| Size | 66.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5a3566516cc53611c84be2f958cfbbe02fb0e51bd332288e8d7f05aacecf99a
|
|
BLAKE2b-256 checksum How to use checksums |
012a4befd071bffe931217f87b34a7fa03b5f406949ef71fef83f2fad81cd690
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Security for pyglpainter 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.