Using the NoGraphics Mode

If your use case consists of using STK Engine as a computational tool and does not require 2D/3D visualization (for instance, if your application is running as a service on a compute node without direct user interaction), using the NoGraphics option results in faster load times and a lighter memory footprint. When that option is turned on, all 2D and 3D graphics support is skipped, and the code and libraries related to graphics do not get loaded into memory. This option must be set to true when running on hardware that does not have hardware or software support for OpenGL or X11 on Linux. It needs to be turned on during initialization and cannot be changed afterwards. The 2D, 3D and Graphics Analysis controls are obviously not available. To select this mode, set the NoGraphics property to true after creating the STK X application object and before performing any other operation with STK Engine:


IAgSTKXApplication app = new AgSTKXApplication();
app.NoGraphics = true;


To setup the JVM in headless mode you must set the java.awt.headless system property. You can do this by adding the following code to your application( NOTE: You can see this code utilized in the NoGraphics Java Code Sample ):

AgSTKXApplicationClass app = new AgSTKXApplicationClass();

You can also set it through the command line:

java -Djava.awt.headless=true

Be aware that once in NoGraphics mode, any attempt to use APIs related to graphics will fail. For instance this snippet of C# code:

IAgSTKXApplication app = new AgSTKXApplication();
app.NoGraphics = true;

AgStkObjectRoot root = new AgStkObjectRoot();
IAgScenario scenario = (IAgScenario) root.CurrentScenario;
scenario.Graphics.LabelsVisible = false;

will result in the exception:

Unhandled Exception: System.Runtime.InteropServices.COMException: NoGraphics property
is set to true, Graphics are not available.
  at AGI.STKObjects.IAgScenario.get_Graphics()

Similarly Connect commands related to graphics will NACK in this mode.

The NoGraphics mode also alters the way scenarios are saved and loaded. When an engine application in NoGraphics mode loads a scenario coming from STK Desktop, the 2D and 3D information serialized as part of the scenario is ignored. If that scenario is then saved, all 2D and 3D information will be lost. If the scenario is then loaded into STK Desktop, default graphics options will be used.

STK 11.2.1 Programming Interface