picogl.ui.backend.glut.prefer_glx

Prefer GLX over EGL for PyOpenGL on Linux.

Under Wayland, PyOpenGL often selects the EGL platform. freeglut still creates GLX contexts, so GetCurrentContext() returns 0 and glutDisplayFunc raises:

Attempt to retrieve context when no valid context

Set PYOPENGL_PLATFORM=glx before importing OpenGL.

Import this module before import OpenGL / OpenGL.GLUT.

Attributes

_patched

Functions

prefer_glx() → bool

Force PyOpenGL onto the GLX platform on Linux when unset.

Module Contents

picogl.ui.backend.glut.prefer_glx._patched = False[source]
picogl.ui.backend.glut.prefer_glx.prefer_glx() → bool[source]

Force PyOpenGL onto the GLX platform on Linux when unset.