How do I run OpenGL programs using WSL (Ubuntu 20.04)?

Viewed 3984

Using Ubuntu 20.04 wsl2. I'm trying to get OpenGL working. My X11 forwarding works fine but after installing mesa-utils and ubuntu-desktop and running glxgears causes the window to open, but the gears don't move. I get the following error output in the terminal as well

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
1 Answers

I had to set the following environment variable to make the error go away:

export LIBGL_ALWAYS_INDIRECT=1

For a quick test, run:

glxinfo -B | grep renderer
Related