Running pythonista scene based programs (including shader) in mac and PC
Here is a utility to run pythonista scene based programs (including shader) in mac and PC using pyglet.
This is not 100 percent compatible but with slight changes (mainly for loading images) you can run most of the
pythonista scene based programs.The utility consists of three files, scene.py, shader.py and sound.py.
and the rest of the files are examples. You need to have python 2.7 and pyglet ("pip install pyglet"). There are no other dependencies.
The files mandelbrot.py and julia.py are fractal examples using fragment shader. The files slider.py and nqueen.py are simple games implemented using this utility. Rest of them are test examples. I have tried these examples on both mac and windows PC machines and they seem to work fine. Please let me know if there are any problems or questions.
I started this project to answer the question by @ccc whether his mandelbrot program can be run on Mac machine with
hardware graphic accelarators (shader support) from Python
(See the discussion in https://forum.omz-software.com/topic/3171/relative-performance-of-python2-vs-python3
Is there a similar way to use to the hardware of a Mac from Python?!? Your speedup is incredible!)
@ccc, Did you try this tool? If you need an offline tool to run shadertoy examples( all the great fractal examples,
3D examples), just a six-line code snippet (excluding fragment shader code) in Pythonista (as in mandelbrot.py) would do that.
May be you can add this to your Ten-lines-or-less repository. There does not seem to be a simple wrapper on pyglet or any other tool to do similar thing on windows PC or Mac. (The current code available on internet directly uses opengl apis and they are not very flexible.)
Simulating Pythonista scene behavior on pyglet was straightforward but getting fragement shader working needed a lot of experimentation.