I am trying to draw about 30k rectangles and am getting very poor performance using entities (~10-15fps). As such, I have tried to use a Primitive with geometry instances.
The problem is, this is dynamically loaded. So, I can't create all instances at the start and add them to a primitive.
I have attempted to use the following to create the primitive:
var rectsPrimitive = new Cesium.Primitive({
geometryInstances: ,
appearance: new Cesium.PerInstanceColorAppearance(),
releaseGeometryInstances: false
});
And then this to add geometry instances:
var instance = new Cesium.GeometryInstance({
geometry: new Cesium.RectangleGeometry({
rectangle: Cesium.Rectangle.fromDegrees(lng - 0.0001, lat - 0.0001,
lng + 0.0001, lat + 0.0001),
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: new Cesium.ColorGeometryInstanceAttribute.fromColor(color.withAlpha(0.5)),
}
});
rectsPrimitive.geometryInstances.push(instance);
I get no errors, but nothing seems to get added on the map. If I print rectsPrimitive it seems to have the correct number of geometryInstances.
What am I missing?