Documentation

Unity Engine

Download Unity

Unity Engine

LoadOrtho()

Helper function to set up an orthograhic projection.
Read time 1 minuteLast updated 2 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static void LoadOrtho()

Remarks

Loads an orthographic projection into the projection matrix and loads an identity into the model and view matrices.
The resulting projection performs the following mappings:
1. x = 0..1 to x = -1..1 (left..right)
2. y = 0..1 to y = -1..1 (bottom..top)
3. z = 1..-100 to z = -1..1 (near..far)
This is equivalent to calling GL.LoadIdentity, then GL.LoadProjectionMatrix with
Matrix4x4.Ortho(0, 1, 0, 1, -1, 100)
.
Changing the model, view or projection matrices overrides the current rendering matrices. It is good practice to save and restore these matrices using GL.PushMatrix and GL.PopMatrix.