SimplePolylineGeometry by primitives is error on 2D mode view but fine in 3D

Hello, little help please
im getting into trouble when im choosing to use primitives for faster loading bunch of geometry at once,

everything just fine on 3D, but not in 2D

the error is shown below:

An error occurred while rendering. Rendering has stopped.

RangeError: Invalid typed array length

RangeError: Invalid typed array length

at new Uint16Array (native)

at Object.a.createTypedArray (http://localhost/LAYOUT/cesium24/Workers/createGeometry.js:76:2857)

at Function.h.createGeometry (http://localhost/LAYOUT/cesium24/Workers/createSimplePolylineGeometry.js:61:19088)

at n (http://localhost/LAYOUT/cesium24/Workers/createSimplePolylineGeometry.js:61:19481)

at i (http://localhost/LAYOUT/cesium24/Workers/createGeometry.js:77:25539)

at http://localhost/LAYOUT/cesium24/Workers/createGeometry.js:77:24748

hope someone can share some experience to me,

big thanks~

Hello,

Could you please provide a code sample to reproduce the crash? I"m not sure exactly what would be causing the problem.

Thanks,

Hannah

Hello,

I am receiving the same thing in trying to programmatically update rectangle features:

//----------Rectangles Created with------------------------------
GuiControls.prototype.createRectangle = function( position )
{
    this.engine.primitive.push(new Cesium.GeometryInstance({
        geometry : new Cesium.RectangleGeometry({
        rectangle : Cesium.Rectangle.fromDegrees(position.lon, position.lat, position.lon + 5.0, position.lat + 5.0),
        vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
      }),
      attributes : {
        color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromRandom({alpha : 0.5}))
      }
    }));
}

//----------Rectangles looped through and assigned new latlon coords--------
GuiControls.prototype.updateRectangle = function( llposition, urposition, index )
{
    this.engine.viewer.scene.primitives.removeAll();
    this.engine.primitive[index].geometry._rectangle = Cesium.Rectangle.fromDegrees(llposition.lon, llposition.lat, urposition.lon, urposition.lat);
}

//----------After the primitive objects are updated with new latlons, Primitives added back to the scene-------------
GuiControls.prototype.renderPrimitive = function( number )
{
    for (var i = 0; i < this.engine.primitive.length; i++) {
        this.engine.viewer.scene.primitives.add(new Cesium.Primitive({
        geometryInstances: this.engine.primitive[i],
        //geometryInstances : this.engine.primitiveList,
        appearance : new Cesium.PerInstanceColorAppearance()
        }));
    };
}

I receive the following error when the renderPrimitive function attempts to "...scene.primitive.add(new Cesium.Primitive...":

RangeError: Invalid typed array length: -12
    at new Uint16Array (<anonymous>)
    at Object.i.createTypedArray (https://cesiumjs.org/Cesium/Build/Cesium/Workers/createGeometry.js:60:26945)

Thanks to anyone who might be able to provide some insight to what might trigger this!

Jay

Hi Jay,

It looks like you are adding the primitive to the scene fine initially with a geometry and an appearance, but in your update function, you are removing all primitives, then trying to set the geometry of a specific primitive (which has been marked for removal).

Thanks,

Gabby