FlorianRhiem / pyGLFW

Python bindings for GLFW
MIT License
233 stars 36 forks source link

Requested OpenGL version 1.0, got version 0.0 #70

Closed LvJC closed 1 year ago

LvJC commented 1 year ago

Try to run the example code. And got issue

$ DISPLAY=:1 python demo_glfw.py
/ldap_home/jincheng.lyu/project/animation/.venv/lib/python3.7/site-packages/glfw/__init__.py:916: GLFWError: (65543) b'Requested OpenGL version 1.0, got version 0.0'
  warnings.warn(message, GLFWError)

Here's my pyproject.toml:

[project]
...
requires-python = ">= 3.7"

...
[tool.rye]
managed = true
dev-dependencies = ["glfw==2.5.9", "pyopengl==3.1.7", "opencv-python~=4.    7.0.72", "pyrr~=0.10.3", "pillow~=9.5.0", "scikit-learn~=1.0.2", "imageio~=2.31.1", "PyOpenGL_accelerate~=3.1.7"]
[tool.hatch.metadata]
allow-direct-references = true
FlorianRhiem commented 1 year ago

Hello @LvJC, GLFW seems to want to use X11, but the DISPLAY environment variable is missing. That could have many causes, e.g. you might be using Wayland instead of X11, in that case see this note or you might be in a headless system, etc. Also, is there any relation between the issue subject and the issue content?

FlorianRhiem commented 1 year ago

Just for reference, the error is raised here in case XOpenDisplay fails and the DISPLAY variable is not set.

If you are not sure whether you are using X11 or Wayland, please try using the Wayland version of GLFW (e.g. by setting the PYGLFW_LIBRARY_VARIANT environment variable to wayland).

LvJC commented 1 year ago

Hello @LvJC, GLFW seems to want to use X11, but the DISPLAY environment variable is missing. That could have many causes, e.g. you might be using Wayland instead of X11, in that case see this note or you might be in a headless system, etc. Also, is there any relation between the issue subject and the issue content?

Sorry, my bad. I pasted it wrongly. I updated the description now.

FlorianRhiem commented 1 year ago

That error is likely caused by this code in GLFW. I don't think this is related to this Python wrapper.