Skip to content

Rendering and displays

ANGLE and native OpenGL

ANGLE translates OpenGL ES calls to a graphics API available on the host platform. Using ANGLE provides a common OpenGL ES rendering path across platforms and access to platform graphics APIs through its backends. The desktop backend also supports native OpenGL. Driver support and performance differ across devices, so test both options on representative hardware.

Configure the renderer in AppSettings before starting the application. For example, AppSettings.ANGLE_GLES3 selects ANGLE and AppSettings.LWJGL_OPENGL32 selects a native OpenGL 3.2 profile when the corresponding backend and dependencies are available. Check the launcher generated by the Initializer for the renderer and dependencies it supplies.

High-DPI and render scale

On a high-DPI display, a window’s logical size can differ from the number of pixels in its framebuffer. Set the window size with setWindowSize, but avoid assuming that one logical unit always corresponds to one framebuffer pixel.

AppSettings.setDisplayScaleMode controls how the application handles display scaling. Modes distinguish logical coordinates from native pixels; values above the DPI-aware mode use a larger intermediate framebuffer for supersampling, at additional GPU cost. Values below 1.0 are not a general-purpose render-resolution setting. See the AppSettings Javadoc for platform behavior, and test the UI, post-processing and performance on your target devices.

For a visual comparison of display-scale modes, run jme3test.app.TestDisplayScaling from the engine examples. The example switches between disabled, native-pixel, DPI-aware and 2× supersampling modes. Upscaling a lower-resolution render is a separate rendering technique; do not set an arbitrary fractional display-scale value expecting it to enable that technique.

For example, before starting a desktop application:

AppSettings settings = new AppSettings(true);
settings.setWindowSize(1280, 720);
settings.setDisplayScaleMode(AppSettings.DISPLAY_SCALE_DPI_AWARE);
// Or render at twice the physical framebuffer dimensions:
// settings.setDisplayScaleMode(2f);
app.setSettings(settings);

Edit the settings already configured by the generated launcher instead of creating a second settings object there. A factor of 2 in each dimension renders four times as many pixels into the intermediate framebuffer; profile the cost on the target device.