Clicking “Send to Looking Glass” in the example above will open a new popup window on the connected Looking Glass display. Double-clicking the window will maximize the hologram view to display properly.
If the Looking Glass display is disconnected or the Looking Glass Bridge application is not running then a non-composited, “swizzled” view will be shown in a popup window.
The Looking Glass display composites a “quilt” of multiple scene renderings into a hologram with “depth” when viewed from multiple angles. vtk.js generates multiple scene renderings for each frame in order to generate new “quilt”.
// Force DataAccessHelper to have access to various data source import'@kitware/vtk.js/IO/Core/DataAccessHelper/HtmlDataAccessHelper'; import'@kitware/vtk.js/IO/Core/DataAccessHelper/HttpDataAccessHelper'; import'@kitware/vtk.js/IO/Core/DataAccessHelper/JSZipDataAccessHelper';
import controlPanel from'./controller.html';
// Import the Looking Glass WebXR Polyfill override // Assumes that the Looking Glass Bridge native application is already running. // See https://docs.lookingglassfactory.com/developer-tools/webxr import( // eslint-disable-next-line import/no-unresolved, import/extensions /* webpackIgnore: true */'https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js' ).then((obj) => { // eslint-disable-next-line no-new new obj.LookingGlassWebXRPolyfill(); });
// ---------------------------------------------------------------------------- // Standard rendering code setup // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // Example code // ---------------------------------------------------------------------------- // create a filter on the fly, sort of cool, this is a random scalars // filter we create inline, for a simple cone you would not need // this // ----------------------------------------------------------------------------
vrbutton.addEventListener('click', (e) => { if (vrbutton.textContent === 'Send To Looking Glass') { xrRenderWindowHelper.startXR(XrSessionTypes.LookingGlassVR); vrbutton.textContent = 'Return From Looking Glass'; } else { xrRenderWindowHelper.stopXR(); vrbutton.textContent = 'Send To Looking Glass'; } });
// ----------------------------------------------------------- // Make some variables global so that you can inspect and // modify objects in your browser's developer console: // -----------------------------------------------------------