pygame-web / pkg-porting-wasm

Tracks porting efforts on some modules you'd like to have working in pygbag
https://pygame-web.github.io/wiki/pkg/
4 stars 0 forks source link

pyopengl as a wheel #25

Open andreagalle opened 10 months ago

andreagalle commented 10 months ago

I added this wheel below, because I need to use OpenGL in my pygame project (using pygbag):

https://files.pythonhosted.org/packages/99/48/00e31747821d3fc56faddd00a4725454d1e694a8b67d715cf20f531506a5/PyOpenGL-3.1.7-py3-none-any.whl

of course I am pointing to my own cdn, but I am getting the following error:

pkg : http://localhost:8000/archives/repo/pkg/PyOpenGL-3.1.7-py3-none-any.whl
 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| 100.0% 
1202: want='PIL' found : True
pkg : http://localhost:8000/archives/repo/pkg/PIL-9.1.1-cp311-cp311-wasm32_mvp_emscripten.whl
 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| 100.0% 
646: starting shell
996: 122 lines queued for async eval
going interactive
643: TODO detect input/print to select repl debug
Traceback (most recent call last):
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: ('Could not load dynamic lib: GLX\nError: http://localhost:8000//archives/0.7/python311/GLX: file not found, and synchronous loading of external files is not available', 'GLX', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: ('Could not load dynamic lib: OpenGL\nError: http://localhost:8000//archives/0.7/python311/OpenGL: file not found, and synchronous loading of external files is not available', 'OpenGL', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: ('Could not load dynamic lib: GL\nError: http://localhost:8000//archives/0.7/python311/GL: file not found, and synchronous loading of external files is not available', 'GL', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/OpenGL/platform/glx.py", line 25, in GL
    raise ImportError("Unable to load OpenGL library", *err.args)
ImportError: ('Unable to load OpenGL library', 'Could not load dynamic lib: GL\nError: http://localhost:8000//archives/0.7/python311/GL: file not found, and synchronous loading of external files is not available', 'GL', None)

Is there any shortcoming you forsee doing this? Is there any possibility that pygbag can support openGL?

pmp-p commented 10 months ago

WebGL uses GLES not OpenGL, it is possible to have OpenGL 1.0 emulation but it is only usefull for initial window setup. You should go for something modern like ZenGL ( which is expected to be pygbag compatible at some point).

But the most important is that WebGPU is coming soon so more power to game engines that deal with low level WGPU/Vulkan/DX12/Metal.

OpenGL - is - dead and will have backport layer anyway at some point to resurrect old programs.

So meanwhile please save your time and use/learn/teach 3D game engines that provide abstraction.

A perfectly decent FOSS alternative to competitors around is Panda3D. eg on itch https://itch.io/c/3724091/panda3d-wasm

transfering to porting.

andreagalle commented 10 months ago

What about Godot (https://godotengine.org/), I see Panda3D is a game engine too. Isn't there the possibility just to import a 3D rendering engine to feed pygame (as well as pygbag) with sequences of PNG files to be blitted on the screen?

pmp-p commented 10 months ago

Godot is great, but it does not use Python (gdscript instead)

Panda3D is as powerfull and C++ built around python interpreter from the start, it can interface with pygame/matplotlib/etc with only a few lines eg https://pygame-web.github.io/showroom/pypad_git.html#src/test_pgp3d.py