# nw-ovrsdk-helloworld **Repository Path**: mirrors_yanyiwu/nw-ovrsdk-helloworld ## Basic Information - **Project Name**: nw-ovrsdk-helloworld - **Description**: A bare-bones example of using node-webkit, THREE.js, and node-ovrsdk to make an Oculus Rift application. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-19 - **Last Updated**: 2026-05-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Node-webkit + THREE.js + node-ovrsdk Tutoral #### Notes * This will only work on Windows until we get the cross-platform SDK and I port to Linux/OSX. * I'm using MinGW/msys here so that it's easier to make this tutorial cross-platform. You'll need to apply your preferred tools appropriately. #### Prerequisites * I'll assume you've checked out this repo and are in its root directory in a terminal. * You should have your compilers installed. Visual Studio on Windows, gcc et. al. on Linux, etc. #### Installation First, lets go into the app directory: ``` cd app ``` This is where you'll be organizing your app. All your assets and code should be placed here. Next, let's install node-ovrsdk: ``` npm install node-ovrsdk ``` This will download node-ovrsdk, place it into the app/node_modules directory, and compile some dependencies with node-gyp. Unfortunately, binaries compiled with node-gyp are not compatible with the version of node-webkit that is compatible with node-ovrsdk. We'll need to compile it with nw-gyp, which is a node-webkit compatible version of node-gyp. Let's first install nw-gyp globally: ``` npm install -g nw-gyp ``` Next, we'll compile the node-ovrsdk dependencies by entering their directories and running nw-gyp. First, the ```ffi``` dependency: ``` cd node_modules/node-ovrsdk/node_modules/ffi nw-gyp rebuild --target=0.8.6 ``` Then the ```ref``` dependency: ``` cd ../ref nw-gyp rebuild --target=0.8.6 ``` Before we go on, let's go back to the app directory: ``` cd ../../../.. ``` The next step is to download the 0.8.6 version of node-webkit, which is the one compatible with node-ovrsdk. You can find it here: https://groups.google.com/forum/#!msg/node-webkit/CLPkgfV-i7s/hwkkQuJ1kngJ Find the download appropriate for your platform, download it, unzip it, and drop its contents into the root of this repo (the directory above the app directory). There's definitely a better way to organize all these files, but this will do for our purposes. #### Building & Running Node-webkit distributes a binary that is intended to be executed with your zipped app as a parameter. Let's first prepare your zipped app (remember, we are in the app/ directory): ``` zip -r ../app.nw * ``` That recursively compressed all the files in the app directory and placed them into a file named "app.nw" one directory up, in the root of this repo. Next, we'll run the app: ``` cd .. nw.exe app.nw ``` With any luck, you'll be presented with a view of Earth, rendered appropriately for view in the Rift. ### The Code Let's take a look at the important bits of the code, next. #### index.html First, take a look at index.html. We include, via the ```