microsoft / HoloJS

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

THREE.FontLoader() support ? #112

Closed tudorw closed 7 years ago

tudorw commented 7 years ago

Hi, I hope someone can help, I'm trying to port a three.js app to work in HoloJS, I've got everything installed and the HoloJS three.js example app launches and works fine on the emulator.

The three.js code I want to port uses TextGeometry which seems to not be supported (yet?)

Adding just the line;

var loader = new THREE.FontLoader();

to the example three.js script returns an error, copied below, I'm new to Visual Studio 2017 so not sure where to go from here, or maybe I've missed something obvious!

'ThreeJSApp-Vs2017.exe' (Win32): Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll' err: egl::GetPlatformDisplayEXT(283): EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is deprecated, please useEGL_EXPERIMENTAL_PRESENT_PATH_ANGLE. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\DXGIDebug.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\rdvgu1132.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\rfxvmt.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\d3d11_3SDKLayers.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Perception.Stub.dll'. Cannot find or open the PDB file. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Globalization.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\BCP47Langs.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\Windows.ApplicationModel.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\powrprof.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. Symbols loaded. 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. Symbols loaded. DXGI WARNING: IDXGIFactory::CreateSwapChain: DXGI_SWAP_CHAIN_DESC.OutputWindow is not a valid window handle. [ MISCELLANEOUS WARNING #65: ] 'ThreeJSApp-Vs2017.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Web.dll'. Symbols loaded. Exception thrown at 0x77402502 in ThreeJSApp-Vs2017.exe: Microsoft C++ exception: ParseExceptionObject at memory location 0x01E0C37C. Failure in file c:\users\tudor_000\source\repos\holojs\holojs\holojshost\scripterrorhandling.h, line 22 The thread 0x54 has exited with code 0 (0x0). The thread 0x9ac has exited with code 0 (0x0).

Almost-Done commented 7 years ago

It should work.

Please take a look at this sample, it uses both FontLoader and TextGeometry to display a message:

https://github.com/Microsoft/HoloJS/blob/master/WebSamples/WebARViewer/WebARViewer.js

tudorw commented 7 years ago

It does work, thank you, I'd missed the changes from 'var' to 'let', if anyone else is trying this, I'm modifying HoloJS-Vs2017/ThreeJSApp-Vs2017/app.js Not knowing how to locate the fonts locally for now I've loaded the font from the web and it works great.

Almost-Done commented 7 years ago

You can add fonts to the project, the same way JS and texture files are added. Then modify the URL in the font loaded. As an example, look at how texture files are added to the project and loaded at runtime in the ThreeJS sample.

When adding font files, make sure you mark them as content so they get copied to the App's package:

image