Initial polyline render sometimes takes many seconds

We have a very simple line drawing tool that draws a polyline entity that can be edited by the user (points can be dragged after the line is drawn).

The first time a line is drawn sometimes takes many seconds for the line to appear. Any subsequent changes to the line are drawn very quickly.

I did find this topic: slow initial rendering of polyline / polygon

I’m wondering if there have been any changes that provide another or better method of eliminating this initial draw delay?

Here’s a link to a simple Sandcastle example that demonstrates the delay.

When Sandcastle loads there’s a panel on the left side. Check the “Enable drawing” checkbox (or right-click on the canvas) to enable drawing. Left-click on the globe to draw several points. Then either uncheck the “Enable drawing” checkbox or right-click on the canvas to have the shape rendered.

The first time you disable the drawing mode and render the polyline is when the pause takes place.

I’d really love to hear from one of the Cesium team about this. The initial draw delay is pretty extreme, and so far I can’t figure out a way to prevent it…

Here are some pointers for the slow rendering:

  • Setting clampToGround to true will slow the drawing down, since ground polylines are expensive to compute especially if you are not using a computer that has a graphics card for hardware acceleration. Setting clampToGround to false should help with performance.
  • What Omar said about web workers in the thread that you linked is still relevant.
  • CallbackProperty will force the line to draw synchronously, but it also makes it re-render every frame, which is probably not something you want if the user has finished drawing the polylines. This is a drawback of the Entity API and there isn’t a way to force the line to only draw synchronously once. Have you considered using the Primitive API instead?

Hi dzung, thanks for the reply.

Can you point me to a simple example of an approach to using the Primitive API for drawing points and polylines that would work well for this situation?