1. A concise explanation of the problem you're experiencing.
I am running into a memory problem while updating a czml point.
The memory usage increases in a slow consistent manner after the update function is initiated.
After 15 to 20 minutes of running, the webpage crashes with a webGl error:
"WebGL content is taking too long to render on your GPU. Temporarily switching to software rendering."
Followed by several "CONTEXT_LOST" errors.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
//Example of data (the lat/lon values change with every data update request)
var coorVals = '{"id": "identity", "lat": -50.20, "lon": 38}';
var streamWindow;
var arrayVals = ;
function arrayUpdate(){
console.log("coorObj: " + coorVals);
var coorObj = JSON.parse(coorVals);
var lat = coorObj.lat;
var lon = coorObj.lon;
arrayVals.push(lat,lon)
}
function loadCzml(){
sendMsg("update");
initialCzmlLoad = formatPoint();
viewer.dataSources.add(dataSource3.load(initialCzmlLoad));
}
// This is the main function, which is activated and killed via buttons
// The interval is 3 seconds
function liveStreamUpdate(){
loadCzml();
streamWindow = window.setInterval(function(){
sendMsg("update");
arrayUpdate();
localObj = formatPointUpdate();
viewer.dataSources.add(dataSource3.process(localObj));
}, 3000);
}
function formatPointUpdate(){
var coorObj = JSON.parse(coorVals);
var lat = coorObj.lat;
var lon = coorObj.lon;
var id = coorObj.id;
var czmlEntity = [{
"id" : "document",
"name" : "CZML Point",
"version" : "1.0"
}, {
"id" : id,
"label" : {
"text":"Lat: " + lat + "\nLon: " + lon + "\nID: " + id
//verticalOrigin: Cesium.verticalOrigin.CENTER
},
"position" : {
"cartographicDegrees" : [lat, lon, 500]
}
}];
return(czmlEntity);
}
function formatPoint(){
console.log("COR: " + coorVals);
var coorObj = JSON.parse(coorVals);
var lat = coorObj.lat;
var lon = coorObj.lon;
var id = coorObj.id;
var czmlEntity = [{
"id" : "document",
"name" : "CZML Point",
"version" : "1.0"
}, {
"id" : id,
"name" : "AGI",
"description" : "",
"label" : {
"font" :'11pt Lucida Console',
"horizontalOrigin" : "LEFT",
"outlineColor":{
"rgba":[
0,0,0,255
]
},
"pixelOffset": {
"cartesian2" : [15,0]
},
"outlineWidth":1,
"showBackground":true,
"backgroundOutline":true,
"style":"FILL_AND_OUTLINE",
"text":"Lat: " + lat + "\nLon: " + lon + "\nErr: " + id
},
"position" : {
"cartographicDegrees" : [lat, lon, 500]
},
"point": {
"color": {
"rgba": [16, 87, 138, 255]
},
"outlineColor": {
"rgba": [255,125,26,255]
},
"outlineWidth": 2,
"pixelSize": 8
}
}];
return(czmlEntity);
}
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I am visualizing a flight path in real-ish time with nothing but lat/lon/height. The lat/lon/height values are being retrieved via websockets and a czml update is generated in javascript.
4. The Cesium version you're using, your operating system and browser.
Problem exists across multiple platforms:
Cesium: 1.43
Browser: IE11, Chromium-Browser(Ubuntu 16)
OS: Windows, Ubuntu 16