After updating from 1.31 to 1.32, my code that toggles from 2D back to 3D using viewer.scene.morphTo3D(2.0) hangs-up the browser with ballooning memory usage.
I cannot reproduce the issue on my localhost, I have no problems running on my development laptop.
The issue only occurs with the code loaded on my GoDaddy-hosted development server.
I reverted the GoDaddy-hosted development server to Cesium 1.31, and the issue goes away.
After several frustrating hours, trying to narrow-down the cause, it looks like it may be related to
Cesium 1.32 "Added support for an orthographic projection in 3D and Columbus view.
- Set
projectionPicker
totrue
in the options when creating aViewer
to add a widget that will switch projections. #5021 - Call
switchToOrthographicFrustum
orswitchToPerspectiveFrustum
onCamera
to change projections."
My attempt to create a Sandcastle example, using a snippet of my code, follows. Set the ScenePicker in the Viewer to 2D, then click the “3D” button.
var viewer = new Cesium.Viewer(‘cesiumContainer’);
Sandcastle.addToolbarButton(‘3D’, function(){
switch (viewer.scene._mode){
case 2 :
Cesium.when(viewer.scene.morphTo3D(2.0),function(){
viewer.scene.completeMorph();
console.log(“scene.morphTo3D completed…”);
});
break;
case 3 :
console.log(“already in 3D scene mode…”);
break;
}
});
``
When I paste this example code into http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Hello%20World.html&label=Showcases
change to 2D, and click “3D” button, it results in the following error:
An error occurred while rendering. Rendering has stopped.
An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view
Error
at new DeveloperError (http://cesiumjs.org/Cesium/Source/Core/DeveloperError.js:44:19)
at Camera.update (http://cesiumjs.org/Cesium/Source/Scene/Camera.js:922:19)
at Scene.initializeFrame (http://cesiumjs.org/Cesium/Source/Scene/Scene.js:2519:22)
at CesiumWidget.render (http://cesiumjs.org/Cesium/Source/Widgets/CesiumWidget/CesiumWidget.js:685:25)
at render (http://cesiumjs.org/Cesium/Source/Widgets/CesiumWidget/CesiumWidget.js:72:32)
I do not get this error, or any error, on my development site!
The viewer begins to render the scene in 3D, then fails to load any more tiles, as TaskManager shows one of the chrome.exe processes eating up 2GB of available memory.
Does anyone have a suggestion for the next step in troubleshooting and resolving this?
Thanks-
-Jon