microsoft / HoloJS

Provides a framework for creating holographic apps using JavaScript and WebGL.
MIT License
1.19k stars 114 forks source link

console.error() is undefined #18

Closed lwansbrough closed 7 years ago

lwansbrough commented 7 years ago

JavaScript runtime error: Object doesn't support property or method 'error'

warn, and log currently exist, should probably add support for the rest (info, error, etc.) to support existing JS libraries that may use them.

Almost-Done commented 7 years ago

Thank you for filing this issue! This is now fixed and merged into master.

liuminosity commented 7 years ago

hey guys,

Amazing work on this! I have a very basic question related to this--where are these console methods outputting to? In Visual Studio, my Javascript Console is disabled, and I do not see anything in the Output box in Visual Studio. The app is rendering just fine (cone, cube, sphere) appear as normal

More info: I am currently running the threejs sample app and am trying to put in DOM elements into the threejs scene. Ideally, I'd want to put iframes in and render webviews inside a holographic view. However, document.createElement() does not seem to working properly and would like to inspect if document is different than the normal one in a browser.

thanks!

Almost-Done commented 7 years ago

@liuminosity The output is saved to an array in JavaScript and available under the debugger. It is not printed anywhere unfortunately. Can you please file a code issue for printing the messages to the output window?

DOM elements, and the document in general is not supported in HoloJS. Only a minimal subset of DOM elements and document functionality has been implemented to enable canvas rendering using WebGL: canvas element, 2D and WebGL contexts, Image and Video elements (no visuals, just decoding/manipulation/texturing). As such, you have to do all rendering in WebGL (or ThreeJS/WebGL)

If you want to show a flat web view on HoloLens, you can try using a WebView control in a XAML project. If you want to show an immersive web view on HoloLens, you will have to extend the DOM/document in HoloJS and implement 3D controls for the DOM elements. This is beyond the scope of this project and most probably a non-trivial task.

liuminosity commented 7 years ago

@Almost-Done thanks for the fast response! I'll submit a separate code issue for printing messages to the output window.

Appreciate the clarification on DOM elements. Since canvas (and I'm assuming canvas3d) elements are implemented, this means that I would be able to use a library like d3 directly on the canvas elements correct?

Almost-Done commented 7 years ago

@liuminosity The 3D context is fully supported. If D3 can limit itself to the canvas and the 3d context it might work. If you run into difficulties please file code issues. Make sure you give the canvas3D to D3; it is the only canvas that renders to a visible surface. You can get it though document.createElement('canvas3D'). Any other canvas you create is off-screen.

The 2D canvas context is minimally implemented; only drawImage is implemented.

liuminosity commented 7 years ago

@Almost-Done got it--thanks for the help. I'll let you know of any troubles that I encounter!