Microsoft DirectX 8.1 (Visual Basic)

Viewport Rectangle

You define the viewport rectangle in a Microsoft® Visual Basic® application by using the D3DVIEWPORT8 type. The D3DVIEWPORT8 type is used with the following viewport manipulation methods offered by the Direct3DDevice8 class.

The D3DVIEWPORT8 type contains four members—x, y, Width, and Height—that define the area of the render-target surface into which a scene will be rendered, called the viewport rectangle.

These values correspond to the destination rectangle, or viewport rectangle, as shown in the following illustration.

The values you specify for the x, y, Width, and Height members of the D3DVIEWPORT8 type are screen coordinates relative to the upper-left corner of the render-target surface. The type defines two additional members (MinZ and MaxZ) indicate the depth-ranges into which the scene will be rendered.

Microsoft® Direct3D® assumes that the viewport clipping volume ranges from -1.0 to 1.0 in x, and from 1.0 to -1.0 in y. These were the settings used most often by applications in the past. In Microsoft DirectX® 8.x, as in previous releases of DirectX, you can adjust for viewport aspect ratio before clipping, during the projection transformation. This task is covered by topics in Projection Transformation.