Hi
I’ve been scratching my head trying to figure out how to use Three.js from an external renderer.
I saw this example https://totalapis.github.io/sample-code/scene-external-renderer-threejs/index.html which works fine by using r79 version of Three.js.
Instead, a bunch of errors are thrown by using newer versions of Three (such as multipleDefine).
Does anyone have any idea to solve this issue?
Solved! Go to Solution.
Hi BerNat!
Oh, I know the pain and have also run into various issues when wanting to upgrade the libraries in this sample: over time, Three.js has changed, ArcGIS JS API has changed and CORS policies have changed.
Here's a codepen that works with Three.js r124 and above:
https://codepen.io/gsoosalu/pen/JjrZEaR
In the code, you'll also find comments about what exactly is different compared to the previous sample.
Note: this codepen app also works with JS API versions higher than 4.4 (i.e. also with the newest: 4.23), but newer versions run into CORS error when trying to access the ISS location JSON. For tackling that, the following page might be helpful: https://developers.arcgis.com/javascript/latest/cors/
I hope this helps you further!
Hi BerNat!
Oh, I know the pain and have also run into various issues when wanting to upgrade the libraries in this sample: over time, Three.js has changed, ArcGIS JS API has changed and CORS policies have changed.
Here's a codepen that works with Three.js r124 and above:
https://codepen.io/gsoosalu/pen/JjrZEaR
In the code, you'll also find comments about what exactly is different compared to the previous sample.
Note: this codepen app also works with JS API versions higher than 4.4 (i.e. also with the newest: 4.23), but newer versions run into CORS error when trying to access the ISS location JSON. For tackling that, the following page might be helpful: https://developers.arcgis.com/javascript/latest/cors/
I hope this helps you further!
Thank you so much GreteSoosalu!
Your hints solved any issue and definitely saved me a lot of struggles!!