# Rendering Order

#### Rendering Order

The order in which the rendering occurs in SceneComposer follows the next rules:

1. All the widgets from the active scene get updated;
2. All the 2D cameras are rendered: all the cameras are sorted by following the sequence number; all the cameras are rendered on associated surfaces;
3. All the 3D cameras are rendered: all the cameras are sorted by following the sequence number; all the cameras are rendered on associated surfaces;
4. Active camera and all reflection cameras (if existing) are rendered on Scene Editor panel: a) The active camera is added on a list of cameras; b) On the same list all the "reflection camera" children type are added; c) The list is sorted by following the sequence number; d) The cameras from the list are rendered on Scene Editor panel.

#### Buffer Swapping Rules (available for both 2D and 3D)

Usually, the last camera (based on the sequence number) that is rendered on a surface performs a buffer swap (being the latest camera, the frame is completely updated so it can be displayed).

Clearing rules:

- 2D: a) Scissoring not active: cameras clear the surface on the region which is indicated by the viewport b) Scissoring active: cameras clear the surface on the region which is indicated by the scissoring rectangle
- 3D: the cameras clear the surfaces inside the region created by the scissor box (when scissoring is enabled). By default, the scissor box is equivalent with the whole surface (-0, 0, 1, 1). In conformity with OpenGL specifications, the viewport does not affect the clearing region (this is a driver dependent rule).

---