Running opengl under WSL
Table of contents
Opengl and WSL
There is little information about opengl under wsl. The first post that comes up on google with a blog states that opengl doesn’t function under WSL and he gave up.
A response from the WSL repo states that it may/may not work
However, advanced opengl apps can definitely run under WSL!
The demo can be found here
The demo includes scripts for installing the following
Some dependencies to install
sudo apt install mesa-utils sudo apt-get install x11-apps sudo apt install clang sudo apt-get install libglfw3 sudo apt-get install libglfw3-dev
On the desktop, install MobaXterm, which has a X server for displaying graphics from WSL
Run the following to see if it works:
Now compile your program with the flags
-lX11 -lGL `pkg-config --static --libs glfw3`
In your opengl code, DO NOT INITIALIZE THE CORE! Comment it out
Now run your program including the environment variable to tell opengl to run with 3.3
Now you can run opengl applications under WSL! :)
Let me know if this works for you / or you encounter problems!