Pass:setViewport

Sets the viewport. Everything rendered will get mapped to the rectangle defined by the viewport. More specifically, this defines the transformation from normalized device coordinates to pixel coordinates.

Pass:setViewport(x, y, w, h, dmin, dmax)

Arguments

NameTypeDefaultDescription
xnumber The x coordinate of the upper-left corner of the viewport.
ynumber The y coordinate of the upper-left corner of the viewport.
wnumber The width of the viewport.
hnumber The height of the viewport. May be negative.
dminnumber0.0 The min component of the depth range.
dmaxnumber1.0 The max component of the depth range.

Returns

Nothing

Notes

The viewport rectangle can use floating point numbers.

A negative viewport height (with a y coordinate equal to the bottom of the viewport) can be used to flip the rendering vertically.

The default viewport extends from (0, 0) to the dimensions of the target textures, with min depth and max depth respectively set to 0 and 1.

See also