Share via


Matrix.CreateOrthographic Method (Single, Single, Single, Single)

Builds an orthogonal projection matrix.

Syntax

'Declaration
Public Shared Function CreateOrthographic ( _
         width As Single, _
         height As Single, _
         zNearPlane As Single, _
         zFarPlane As Single _
) As Matrix 
public static Matrix CreateOrthographic (
         float width,
         float height,
         float zNearPlane,
         float zFarPlane
)
public:
static Matrix CreateOrthographic(
         float width,
         float height,
         float zNearPlane,
         float zFarPlane
)

Parameters

  • width
    Type: Single
    Width of the view volume.
  • height
    Type: Single
    Height of the view volume.
  • zNearPlane
    Type: Single
    Minimum z-value of the view volume.
  • zFarPlane
    Type: Single
    Maximum z-value of the view volume.

Return Value

Type: Matrix
The projection matrix.

Remarks

Projection space refers to the space after applying projection transformation from view space. After the projection transformation, visible content has x and y coordinates ranging from -1 to 1, and z coordinates ranging from 0 to 1.

Unlike perspective projection, in orthographic projection there is no perspective foreshortening.

The viewable area of this orthographic projection is centered on 0,0,0. The x-axis of the area ranges from -width/2 to width/2. The y-axis of the area ranges from -height/2 to height/2. The z-axis of the area ranges from zNearPlane to zFarPlane. These values are relative to the position and x, y, and z-axes of the view.

To obtain the viewable area (in world space) of a scene, create a BoundingFrustum and pass the combined view and projection matrix to the constructor.

Requirements

Namespace: Microsoft.Xna.Framework

Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

See Also

Reference

Matrix Structure
Matrix Members
Microsoft.Xna.Framework Namespace

Platforms

Windows Phone