Skip to content

Simple starting point for using WebVR from WebAssembly programs in a web browser

License

Notifications You must be signed in to change notification settings

llatta/WebAssembly-WebVR-HelloWorld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebAssembly WebVR Hello World

This is sort of a Hello World program demonstrating driving WebVR from a WebAssembly program in a browser. You should see a spinning triangle, the click/tap on the canvas, and VR mode should start.

Run a compiled version of this test at: http://2ld.de/webvrasm/

It has been tested on Firefox 56, Chrome with WebVR Emulation Extension, and the Oculus Browser on GearVR.

The code uses the WebVR 1.1 API with the C wrapper in emscripten 1.37.22. These APIs are still in flux, so future compatibility is uncertain.

Compilation and Serving

  • Follow the steps here to get ready to compile WebAssembly
  • Clone this directory wherever you want (git clone https://github.com/llatta/WebAssembly-WebVR-HelloWorld.git)
  • cd to the root of the newly cloned directory
  • Use the makefile to either build, clean up, or make a distribution version (build directory only) of the repo
    • Build: make
    • Clean: make clean
    • Build, but remove objects leaving the build dir: make dist
  • You can then use python -m SimpleHTTPServer 8080 and open your browser to localhost:8080.

Acknowledgments

This sample is based on Harry Gould's WebAssembly-WebGL2 sample: https://github.com/HarryLovesCode/WebAssembly-WebGL-2

The usage of the emscripten WebVR 1.1 API is based on Jonathan Hale's emscripten contribution: emscripten-core/emscripten#5508

About

Simple starting point for using WebVR from WebAssembly programs in a web browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published