D3D11_VIEWPORT Structure (d3d11.h)

The D3D11_VIEWPORT structure defines a rectangular screen region into which a rendered scene is projected.

Syntax


typedef struct D3D11_VIEWPORT {
  FLOAT TopLeftX;
  FLOAT TopLeftY;
  FLOAT Width;
  FLOAT Height;
  FLOAT MinDepth;
  FLOAT MaxDepth;
} D3D11_VIEWPORT;
            

Members

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.

Remarks

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].

See Also

Note: This structure is used to define the viewport settings for the rasterizer stage of the Direct3D pipeline. It allows for flexible control over how the rendered scene is mapped to the output surface.