/demosys-py

A light high performance modern OpenGL 3.3+ Python Framework https://demosys-py.readthedocs.io/

Primary LanguagePythonISC LicenseISC

pypi travis Documentation Status

demosys-py

A Python 3 cross platform OpenGL 3.3+ core framework based on ModernGL

screenshot1 screenshot2


Originally made for for non-interactive real time graphics combined with music ("real time music videos", see demoscene) but can of course be used almost any purpose.

Made for people who enjoy playing around with modern OpenGL without spending lots of time creating all the tooling to get things up and running. Using ModernGL also makes working with OpenGL a breeze accomplishing a lot with very few lines of code.

A high priority for this project is also to help improving ModernGL.

Creating a project with a spinning cube can be done in less than a minute.

pip install demosys-py
demosys-admin createproject myproject
demosys-admin createeffect myproject/cube

Now run the effect

python manage.py runeffect myproject.cube

Features

  • A simple effect system based on python packages
  • Supports most modern OpenGL features through ModernGL
  • Resource loading system for shader programs, textures, scenes and misc data
  • Loading GLTF 2.0 and wavefront obj files/scenes
  • Supports the rocket sync-tracker system to create interesting keyframe data (Using pyrocket)
  • Runtime re-loading shader programs (press R)
  • Supports headless rendering and various visible windows such as pyGLFW, PyQt5, PySDL2 and Pyglet.
  • Management commands for creting new projects and effects including the ability to make custom commands
  • A highly pluggable framework with customizable timers, resource loaders, timelines and more
  • A geometry module for quick creation of common mesh/VAO types
  • Experimental audio playback support

Requirements

In order to use the framework it's an advantage to know the following:

  • Basic or intermediate Python
  • Basic glsl
  • Basic matrix math

If you are missing any of these requirements the framework can definitely be used to learn. 0 lines of code are needed to generate a project with a spinning cube and you can star poking at things.

Local Development

Installing the project in development mode (in a virtualenv):

python setup.py develop
# PyQt5 doesn't support develop and have to manually be force-reinstalled installed after
pip install -I PyQt5

Running tests:

# All tests
pip install -r requirements-test.txt
python manage.py test

# Single tests module
python manage.py test tests/test_effect.py

Building docs:

pip install -r docs/requirements.txt
python setup.py build_sphinx

Contributors

Dependencies

  • ModernGL PyOpenGL replacement
  • PIL/Pillow for texture loading
  • Pyrrr for math (uses numpy)
  • PyQt5 is default for window/context creation (works out of the box on most platforms)

Optional:

  • pyGLFW for window/context creation
  • pyglet for window/context creation (Does not work on OS X)
  • pygame using the mixer module for music
  • python-vlc for audio playback

Mentions

Also consider supporting Read the Docs by becoming a gold member though a one time ($5 or more) donation for an ad-free experience.


This project is sponsored by zetta.io

Zetta.IO