How to use X11 displays

In JOGL, there is always one X11 display that is designated as the default display. By default, this is the display specified by the environment variable DISPLAY. When running a Desktop Linux this variable is inherited to all processes such that nothing special has to be done to use JOGL for this standard case.

Using a different default display is possible by either changing the DISPLAY environment variable prior to running the Java process, or alternatively by specifying the Java system property nativewindow.x11.display.default prior to invoking any JOGL code (see | this test case). The system property has precedence over the environment variable if both are set. Using the system property can be useful in situations where the environment variable cannot be changed before running the Java process. This might be the case if the logic for choosing the right display is only known at runtime (think about server-based rendering with several available virtual displays (using X virtual framebuffers) where each render node (a Java process) reads its configuration (the display to use) on program start).

Apart from changing the default display, JOGL allows to connect to additional (e.g. remote) displays. See | this example or | this example.