Viewport Panel
The Viewport panel renders your 3D scene in real time using an offscreen OpenGL framebuffer. It provides editor camera controls and play/stop functionality.
Rendering
The viewport uses a ViewportFramebuffer that renders the scene to an offscreen FBO (GL_RGB color + GL_DEPTH24_STENCIL8 depth/stencil), then displays the result as an ImGui image. The framebuffer resizes dynamically when you resize the panel.
HiDPI support: The framebuffer resolution is scaled by the display content scale factor (via glfwGetWindowContentScale), so the scene renders at native resolution on Retina/HiDPI displays.
Initial framebuffer size: 800×600.
Play / Stop Toolbar
A centered toolbar bar sits above the viewport content:
- Play — Enters play mode: physics, native scripts, and audio activate. The scene is snapshot before play so it can be restored on stop.
- Stop — Exits play mode: reverts the scene to its pre-play state.
See Scene Management for details on the snapshot/restore cycle.
Editor Camera
The editor uses a free-flying camera (separate from any in-scene Camera component):
Camera defaults:
The aspect ratio updates automatically to match the viewport panel dimensions.