The D3D11_VIEWPORT structure defines a rectangular screen region into which a rendered scene is projected.
typedef struct D3D11_VIEWPORT {
FLOAT TopLeftX;
FLOAT TopLeftY;
FLOAT Width;
FLOAT Height;
FLOAT MinDepth;
FLOAT MaxDepth;
} D3D11_VIEWPORT;
Member | Description |
---|---|
TopLeftX | The x-coordinate of the upper-left corner of the viewport. |
TopLeftY | The y-coordinate of the upper-left corner of the viewport. |
Width | The width of the viewport. |
Height | The height of the viewport. |
MinDepth | The minimum depth of the clipping volume. Range is 0.0 to 1.0. |
MaxDepth | The maximum depth of the clipping volume. Range is 0.0 to 1.0. |
A viewport defines the rectangular region of the render-target surface into which rendering occurs. The coordinates are in screen space.
The dimensions of the viewport are specified in screen units. The depth range is specified in terms of normalized device coordinates (NDC).
The Width and Height members define the viewport's dimensions. If the viewport is smaller than the render-target surface, the rendering will be clipped to the viewport dimensions.
The MinDepth and MaxDepth members define the range of depth values that will be written to the depth buffer. These values are typically clamped to the range [0.0, 1.0].