Viewport Structure

Language:

Defines the window dimensions of a render target surface onto which a 3-D volume projects.

Definition

Visual Basic Public Structure Viewport
C# public struct Viewport 
C++ public value class Viewport sealed 
JScript In JScript, you can use structures, but you cannot define your own.

Members Table

Method Description
ToString Obtains a string representation of the current instance.
Viewport Initializes a new instance of the Viewport class.
Property Description
Height Retrieves or sets the height dimension of the viewport on the render target surface, in pixels.
MaxZ Retrieves or sets the maximum value of the clip volume.
MinZ Retrieves or sets the minimum value of the clip volume.
Width Retrieves or sets the width dimension of the viewport on the render target surface, in pixels.
X Retrieves or sets the pixel coordinate of the upper-left corner of the viewport on the render target surface.
Y Retrieves or sets the pixel coordinate of the upper-left corner of the viewport on the render target surface.

Remarks

The X, Y, Width, and Height 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 MinZ and MaxZ properties typically are set to 0.0 and 1.0, but can be set to other values to achieve specific effects. For example, setting them both to 0.0 can force the system to render objects to the foreground of a scene, while setting both to 1.0 can force the objects into the background.

When the viewport parameters for a device change (due to the use of the Device.Viewport property), the driver builds a new transformation matrix.

Structure Information

Namespace Microsoft.DirectX.Direct3D
Assembly Microsoft.DirectX.Direct3D (microsoft.directx.direct3d.dll)
Strong Name Microsoft.DirectX.Direct3D,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center