Open danchitnis opened 1 year ago
Hmm, is GLFW using Wayland or X11? One defaults to EGL and the other to GLX. If GLFW and the OpenGL bindings are talking to different context creation APIs then that could explain it.
I am getting this:
b'3.3.8 X11 GLX EGL OSMesa clock_gettime evdev shared'
b'4.1 (Core Profile) Mesa 22.2.5'
on these commands:
print(glfw.get_version_string())
print(gl.glGetString(gl.GL_VERSION))
I know that WSLg runs on Wayland, so how to force GLFW (and OpenGL) to use Wayland?
WSLg supports both X11 and Wayland, though it isn't clear to me from the above which APIs the Python binding is using.
If you want to switch self-compiled GLFW 3.3 to using Wayland then you need to compile it for Wayland. If you are using the GLFW package from your distribution, install the Wayland variant of it if there is one.
Thanks for your advice. I think there is an issue with OpenGL and window context creation. I did some tests and only got it working in the following condition:
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 1)
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 5)
glfw.window_hint(glfw.CONTEXT_CREATION_API, glfw.EGL_CONTEXT_API)
If I choose a different context version or native context, it doesn't work. This is with the X11 backend. Although I am enforcing version 1.5, I am still getting version 4.1 when doing GL_VERSION
, and in fact, shaders compile with #version 330
. So I am not sure what the connection between the two is.
In Wayland, it works with both native context and EGL as long as it is explicitly enforced. However, the windows have a cursor issue, and I get this error:
GLFWError: (65544) b'Wayland: Focusing a window requires user interaction'
The same OpenGL version problem occurs in Wayland similar to X11 in both native and EGl contexts.
In fact, is the glfw.window_hint
setting the OpenGL version or EGL? in this case it looks like it is setting the EGL version rather OpenGL.
Although I am enforcing version 1.5, I am still getting version 4.1 when doing
GL_VERSION
, and in fact, shaders compile with#version 330
. So I am not sure what the connection between the two is.
The GLFW_CONTEXT_VERSION_MAJOR
and GLFW_CONTEXT_VERSION_MINOR
hints specify the minimum version you require, but the system is free to give you a context of any later version that's compatible with what you asked for. In this case you got OpenGL 4.1 with the compatibility profile, which can do everything OpenGL 1.5 can do.
In Wayland, it works with both native context and EGL as long as it is explicitly enforced.
This is likely because EGL is the native context creation API on Wayland.
However, the windows have a cursor issue, and I get this error:
GLFWError: (65544) b'Wayland: Focusing a window requires user interaction'
How odd, you shouldn't get that error with GLFW 3.3.8 unless you're calling glfwShowWindow
or glfwFocusWindow
.
What cursor issue did you get?
GLFWError: (65544) b'Wayland: Focusing a window requires user interaction'
The above was with standard Ubuntu libglfw 3.3.6-1 package. Now when I use the 3.3.8 shipped with pyGLFW I get the following error:
GLFWError: (65544) b'Wayland: Standard cursor shape unavailable'
The error is that the window opens with the correct OpenGL drawing, however, the title bar is blank gray and there is no closing button on the title bar. I have to do Crtl+C to close the window.
The above was with standard Ubuntu libglfw 3.3.6-1 package.
Oh, that makes sense. That was an issue in 3.3.6 but not in the latest release.
Now when I use the 3.3.8 shipped with pyGLFW I get the following error:
GLFWError: (65544) b'Wayland: Standard cursor shape unavailable'
This could be the active cursor theme lacking that particular cursor, or it could be a bug in the GLFW Wayland code.
The error is that the window opens with the correct OpenGL drawing, however, the title bar is blank gray and there is no closing button on the title bar. I have to do Crtl+C to close the window.
Those are the GLFW fallback decorations for Wayland and yes, they're very limited. Better decorations are on the way!
Now when I use the 3.3.8 shipped with pyGLFW I get the following error:
GLFWError: (65544) b'Wayland: Standard cursor shape unavailable'
This has been fixed in GLFW 3.3.9 with 1d766c8b39936469280001a18f506c4efb394cb8.
The error is that the window opens with the correct OpenGL drawing, however, the title bar is blank gray and there is no closing button on the title bar. I have to do Crtl+C to close the window.
This has been fixed in GLFW 3.3.9 by adding support for libdecor. If you install the libdecor-0-0
package, GLFW will now detect this and provide better window decorations.
Any update ? I have the same problem. Thanks
Hello, I am trying to write a very simple test code using pyGLFW:
However, the code fails in WSL2 on the line:
gl.glVertexAttribPointer(positionLocation, 2, gl.GL_FLOAT, gl.GL_FALSE, 0, None)
with the error:Otherwise, the window creation works fine. The code also runs fine in Windows natively.
I have run similar codes with other libraries which use GLFW like pyglet and VisPy, and both work fine, so I suspect there is some setting related to GLFW which is causing the issue. Any suggestions on how to debug further?
The output of
glxinfo -B
is:Also
glxgears
andglxheads
work fine.