ViewPorts

A ViewPort represents a rendering surface where one or more scenes (root nodes) are rendered.

Example

viewPort.attachScene(rootNode);
Node scene = viewPort.getScenes().get(0);

Each application typically has:

  • A main viewport — for the primary 3D scene.
  • A GUI viewport — for 2D UI elements.

ViewPorts consist of:

  • Camera — Defines the viewpoint.
  • Scenes — Root nodes attached to the ViewPort.
  • Framebuffer — Target render surface (typically the screen).
  • Render settings — Clean flags, background color, etc.

Note

A ViewPort can render multiple scenes simultaneously.

Tip

You can create additional ViewPorts for advanced use cases like:

  • Mini-maps
  • Split-screen views
  • Off-screen rendering
ViewPort vp = renderManager.createMainView("MyView", camera);