Microsoft Releases HoloJS, A JavaScript Framework To Build HoloLens Apps

Microsoft has released a new framework, HoloJS, on GitHub today, that creates holographic apps for its renowned AR glasses, Hololens. As the name suggests, HoloJS framework is a JavaScript based C++ library and it employs WebGL and JavaScript for creating UWP applications which work on HoloLens too, along with other Windows 10 devices.
 
On the official GitHub page, the company has defined HoloJS as,

“HoloJS is a C++ library that hosts Chakra to run JavaScript code, and also hosts ANGLE to handle OpenGL ES graphics calls. OpenGL ES calls are translated from WebGL calls by the JavaScript app. When running on a Microsoft HoloLens, HoloJS supports holographic rendering. This library requires Visual Studio 2015 Update 3 to build, and supports Windows Universal platforms such as Windows 10 and Windows Holographic. ”
 
A sample project has also been uploaded there on GitHub for Windows Holographic, and users can download and try it for free. However, it takes a little time to load the sample on the device and unluckily, there is no loading indicator as of now, which obviously may irritate some of the developers.
 
As per the company,
 
“ The sample works on Windows Holographic by getting a holographic view matrix from the HoloJS host layer. This is done in JavaScript by calling window.getViewMatrix():
  1. // Draw the cube.  
  2. gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVerticesIndexBuffer);  
  3. gl.uniformMatrix4fv(pUniform, falsenew Float32Array(identity));  
  4. gl.uniformMatrix4fv(mUniform, falsenew Float32Array(model));  
  5. gl.uniformMatrix4fv(vUniform, false, window.getViewMatrix());  
  6. gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);  
This view matrix represents a view from the middle point between left and right views of the holographic stereo camera. The app should not set a projection matrix in this case, or it should set a projection matrix that is the identity matrix. ANGLE for Windows Holographic will apply the correct projection matrices for the holographic device to each vertex automatically, after splitting the output into left and right views by using a geometry shader.”
 
The company has provided with the link from where one can install the tools, like Visual Studio 2015 and HoloLens Emulator. There is one important thing to notice though, the Microsoft HoloLens Emulator does not work on Windows 10 Home edition.
 
Along with this, Microsoft has shared the information of how to work with HoloJS, such as - how to build sample, test it on Microsoft HoloLens Emulator, and then finally deploy it on Microsoft HoloLens.
 
You can get the full information on the official GitHub page for HoloJS. To know how to setup your Holographic Development Environment, watch the following video.
 
Next Recommended Reading
Sunglass Sized VR Headset Released To Compete With Oculus and HoloLens