Platform SDK: DirectX

D3DVIEWPORT7

The D3DVIEWPORT7 structure defines the window dimensions of a render target surface onto which a 3-D volume projects. This structure is used with the IDirect3DDevice7::GetViewport and IDirect3DDevice7::SetViewport methods.

typedef struct _D3DVIEWPORT7{
    DWORD       dwX;
    DWORD       dwY;
    DWORD       dwWidth;
    DWORD       dwHeight;
    D3DVALUE    dvMinZ;
    D3DVALUE    dvMaxZ;
} D3DVIEWPORT7, *LPD3DVIEWPORT7

Members

dwX and dwY
Pixel coordinates of the upper-left corner of the viewport on the render target surface. Unless you want to render to a subset of the surface, these members can be set to 0.
dwWidth and dwHeight
Dimensions of the viewport on the render target surface, in pixels. Unless you are rendering only to a subset of the surface, these members should be set to the dimensions of the render target surface.
dvMinZ and dvMaxZ
Values of the D3DVALUE type describing the range of depth values into which a scene is to be rendered. Most applications set these values to 0.0 and 1.0, respectively. The interpretation of the values in these members is completely different from the corresponding members in the legacy D3DVIEWPORT2 structure. Clipping in DirectX 7.0 is performed after applying the projection matrix. For more information, see Clipping Volumes and The Projection Transformation.

Remarks

This structure, introduced in DirectX 7.0, supersedes the D3DVIEWPORT2 and D3DVIEWPORT structures used with previous versions of DirectX.

The dwX, dwY, dwWidth, and dwHeight members describe the position and dimensions of the viewport on the render target surface. Usually, applications render to the entire target surface; when rendering on a 640x480 surface, these members should be 0, 0, 640, and 480, respectively. The dvMinZ and dvMaxZ are typically set to 0.0 and 1.0 but can be set to other values to achieve specific effects. For example, you might set them both to 0.0 to force the system to render objects to the foreground of a scene, or both to 1.0 to force the objects into the background.

When the viewport parameters for a device change (due to a call to the IDirect3DDevice7::SetViewport method), the driver builds a new transformation matrix.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dtypes.h.

See Also

D3DVALUE, IDirect3DDevice7::GetViewport, IDirect3DDevice7::SetViewport, Clipping Volumes, Viewports and Clipping