Sets an array of viewports, one of which is used for transformations and clipping.
- iOS 12.0+
- macOS 10.13+
An array of viewports.
The number of viewports in the array.
Use this method to specify multiple active viewports and corresponding scissor rectangles, enabling you to draw into separate areas of an image without issuing multiple separate draw calls.
Only one of the viewports in the array is used for transformations and clipping. You select this viewport by specifying a
[[viewport value in your vertex shader.
Calling this method with a single-viewport array is equivalent to calling the
set method. Calling
set after calling
set overrides previously set viewports, and vice-versa.
You can call the
set method to set a single scissor rectangle for all viewports. Otherwise, you can call the
set method to set different scissor rectangles for different viewports, as long as the number of scissor rectangles matches the number of viewports.