Structure

MTLViewport

A 3D rectangular region for the viewport clipping.

Declaration

struct MTLViewport

Topics

Creating a Viewport

init()

Returns a new viewport.

Specifying Viewport Boundaries

var originX: Double

The x coordinate of the upper-left corner of the viewport.

var originY: Double

The y coordinate of the upper-left corner of the viewport.

var width: Double

The width of the viewport, in pixels.

var height: Double

The height of the viewport, in pixels.

var znear: Double

The z coordinate of the near clipping plane of the viewport.

var zfar: Double

The z coordinate of the far clipping plane of the viewport.

See Also

Setting Viewport and Scissor Behavior

Rendering to Multiple Viewports in a Draw Command

Select viewports and their corresponding scissor rectangles in your vertex shader.

func setViewport(MTLViewport)

Sets the viewport used for transformations and clipping.

Required.

func setViewports([MTLViewport])

Sets an array of viewports.

func setScissorRect(MTLScissorRect)

Sets the scissor rectangle for a fragment scissor test.

Required.

func setScissorRects([MTLScissorRect])

Sets an array of scissor rectangles.

struct MTLScissorRect

A rectangle for the scissor fragment test.