The primitive manager contains spatial data structures used to efficiently render primitives. Once a primitive is initialized, it must be added to the primitive manager before it will be rendered. For example:
PolylinePrimitive polyline = new PolylinePrimitive(); polyline.setCartographic(CentralBodiesFacet.getFromContext().getEarth(), Arrays.asList(Cartographic.getZero(), new Cartographic(0.017, 0.0, 0.0))); SceneManager.getPrimitives().add(polyline);
Once added to the manager, primitives are rendered the next time the scene is redrawn. This will happen when the user clicks a mouse button or the animation time changes. The scene can also be redrawn explicitly:
SceneManager.render(); // Redraw every 3D scene scene.render(); // Redraw just one 3D scene
For best performance, add several primitives to the manager and only redraw the scene once after adding all the primitives. If you are familiar with STK, this is similar to using BatchGraphics.
When a primitive should no longer be rendered, remove it from the manager: