mcfletch / pyopengl

Repository for the PyOpenGL Project
Other
314 stars 97 forks source link

EGL problem in 3.1.6 #89

Closed SebKuzminsky closed 1 year ago

SebKuzminsky commented 1 year ago

Hi there folks, I'm running pyopengl 3.1.6 on Debian Bookworm (aka Testing). I'm running in to a problem on Wayland:

$ python3 -c 'from OpenGL.GLUT import *'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/OpenGL/GLUT/__init__.py", line 5, in <module>
    from OpenGL.GLUT.fonts import *
  File "/usr/lib/python3/dist-packages/OpenGL/GLUT/fonts.py", line 20, in <module>
    p = platform.getGLUTFontPointer( name )
  File "/usr/lib/python3/dist-packages/OpenGL/platform/baseplatform.py", line 350, in getGLUTFontPointer
    raise NotImplementedError( 
NotImplementedError: Platform does not define a GLUT font retrieval function

The issue happens only on Wayland (which now uses EGL), and only if I don't force the platform to GLX:

$ echo $XDG_SESSION_TYPE
wayland

$ python3 -c 'from OpenGL.GLUT import *'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/OpenGL/GLUT/__init__.py", line 5, in <module>
    from OpenGL.GLUT.fonts import *
  File "/usr/lib/python3/dist-packages/OpenGL/GLUT/fonts.py", line 20, in <module>
    p = platform.getGLUTFontPointer( name )
  File "/usr/lib/python3/dist-packages/OpenGL/platform/baseplatform.py", line 350, in getGLUTFontPointer
    raise NotImplementedError(
NotImplementedError: Platform does not define a GLUT font retrieval function

$ PYOPENGL_PLATFORM=x11 python3 -c 'from OpenGL.GLUT import *; print("no problem")'
no problem

Looking at OpenGL.platform.egl, there is indeed no getGLUTFontPointer() function, unlike in OpenGL.platform.glx where the function does exist.

The problem is not present in 3.1.5, because the older platform detection code there does not try to detect Wayland and so chooses GLX (which works) instead of EGL (which fails):

3.1.5:

3.1.6:

swt2c commented 1 year ago

@SebKuzminsky I believe #91 should resolve this. Can you confirm it works for your application(s)?