Skip to content

Instantly share code, notes, and snippets.

@davydka
Last active May 10, 2024 02:47
Show Gist options
  • Save davydka/6715e74bd67501ee0a98e40b9820857c to your computer and use it in GitHub Desktop.
Save davydka/6715e74bd67501ee0a98e40b9820857c to your computer and use it in GitHub Desktop.
X11 setup for Windows Susbsytem for Linux (WSL)
  • Open Powershell as Administrator and run: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Open the Microsoft Store, search for Ubuntu, and install
  • Launch Ubuntu and create your Linux user
  • Open a shell into WSL (I like cmder so far: http://cmder.net/)
  • In Windows, download and install MobaXterm (free version): https://mobaxterm.mobatek.net/download.html
  • Make sure X server is running
    • You’ll always need to run MobaXterm, and in the top right corner of the app there’s an "X server" button. Make sure it’s running.
    • In mobaxterm settings -> x11 -> set OpenGL Acceleration to: Hardware
  • WSL won't have a display environment variable set by default, so tell it manually to connect to the first display: export DISPLAY=:0.0
  • Test an x11 app: sudo apt-get install x11-apps
    • xyeyes
  • Download OF: curl -OLk https://openframeworks.cc/versions/v0.10.0/of_v0.10.0_linux64gcc6_release.tar.gz
  • Unpack and move wherever: untar -xvf of_v0.10.0_linux64gcc6_release.tar.gz
  • mv of_v0.10.0_linux64gcc6_releas/ of/
  • Install ubuntu deps: cd of/scripts/linux/ubuntu
  • sudo ./install_dependencies.sh
  • sudo ./install_codecs.sh
  • Make an example: cd of/examples/graphics/graphicsExample
  • glfw errors out at the moment, use glut
  • edit src/main.cpp
// Refer to the README.md in the example's root folder for more information on usage                        
                                                                                                            
#include "ofMain.h"                                                                                         
#include "ofApp.h"                                                                                          
                                                                                                            
//========================================================================                                  
int main( ){                                                                                                
                                                                                                            
  ofAppGlutWindow window;                                                                                   
  ofSetupOpenGL(&window, 1024, 768, OF_WINDOW);                                                             
  // ofSetupOpenGL(1024,768, OF_WINDOW);                        // <-------- setup the GL context           
                                                                                                            
        // this kicks off the running of my app                                                             
        // can be OF_WINDOW or OF_FULLSCREEN                                                                
        // pass in width and height too:                                                                    
        ofRunApp( new ofApp());                                                                             
                                                                                                            
}                                                                                                           
  • make
  • make run
@Halaume
Copy link

Halaume commented Jul 9, 2022

Missing a "e" on mv of_v0.10.0_linux64gcc6_releas/ of/ --> mv of_v0.10.0_linux64gcc6_release/ of/

@Imrealmfzi
Copy link

thanks it's helpfull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment