Skip to content

Commit

Permalink
Merge pull request #106 from bhperry/wsl-install-instructions
Browse files Browse the repository at this point in the history
Add instructions for running pixel on WSL
  • Loading branch information
bhperry authored Aug 18, 2024
2 parents fad5035 + 6b8510b commit 770adb1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ possible!

If you're using Windows and having trouble building Pixel, please check [this
guide](https://github.com/gopxl/pixel/wiki/Building-Pixel-on-Windows) on the
[wiki](https://github.com/gopxl/pixel/wiki).
[wiki](https://github.com/gopxl/pixel/wiki). Alternatively you can try running on WSL, as described [below](#windows-subsystem-for-linux).

OpenGL development libraries are needed for compilation. The dependencies
are same as for [GLFW](https://github.com/go-gl/glfw).
Expand All @@ -164,6 +164,17 @@ The OpenGL version used is **OpenGL 3.3**.
[#7](https://github.com/gopxl/pixel/v2/issues/7). This issue is probably not related to Pixel.
**Upgrading to Go 1.8.1 fixes the issue.**

### Windows Subsystem for Linux

While pixel does run on Windows, you will likely have significantly better performance running in WSL2, which now has support for GUI applications built-in with WSLg.

Installation instructions [here](https://github.com/microsoft/wslg?tab=readme-ov-file#installing-wslg). If you already have an old version of WSL installed,
make sure to follow the upgrade instructions to get WSL2 as well as update your distribution of choice to version 2. Additionally, if you have an old `DISPLAY` environment variable set in your ~/.bashrc (or equivalent) for WSL1, you should remove it. This is now configured automatically.

Once WSL is setup, follow the usual Go and OpenGL installation instructions for your chosen distribution of linux.

Finally, add `export LIBGL_ALWAYS_INDIRECT=0` to your ~/.bashrc (or equivalent) if you see an error like `Error: creating window failed: VersionUnavailable: GLX: Failed to create context: GLXBadFBConfig` when attempting to launch an OpenGL application from WSL.

## Contributing

Join us in the [Discord Chat!](https://discord.gg/n2Y8uVneK6)
Expand Down

0 comments on commit 770adb1

Please sign in to comment.