Platform SDK: DirectX

D3DVIEWPORT7

The D3DVIEWPORT7 type defines the window dimensions of a render target surface that a 3-D volume projects onto. This type is used with the Direct3DDevice7.GetViewport and Direct3DDevice7.SetViewport methods.

Type D3DVIEWPORT7
    lHeight As Long
    lWidth As Long
    lX As Long
    lY As Long
    maxz As Single
    minz As Single
End Type

Members

lHeight and lWidth
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.
lX and lY
Pixel coordinates of the top-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 zero.
minz and maxz
Values describing the range of depth values into which a scene will be rendered. (Note that depth-based clipping in DirectX 7.0 is performed through the values in the projection matrix.) Most applications set these values to 0.0 and 1.0, respectively, but you might set them both to 0.0 to force the system to render objects to the foreground of a scene. Clipping in DirectX 7.0 is performed after applying the projection matrix. For more information, see Clipping Volumes and The Projection Transformation.

Remarks

The lX, lY, lHeight and lWidth members describe the position and dimensions of the viewport on the render target surface. Usually, applications render to the entire target surface; when rendering to a 640x480 surface, these members should be 0, 0, 640, and 480, respectively. The minz and maxz are typically set to 0.0 and 1.0, but can be set to other ranges 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 (by calling Direct3DDevice7.SetViewport), the driver builds a new transformation matrix.

See Also

Direct3DDevice7.GetViewport, Direct3DDevice7.SetViewport, Clipping Volumes, Viewports and Clipping