Version: 2017.1

GL.PopMatrix

切换到手册
public static void PopMatrix ();

描述

从矩阵堆栈顶部恢复投影和 modelview 矩阵。

更改 modelview 或投影矩阵会重写当前摄像机的参数。 可使用 GL.PushMatrixGL.PopMatrix 保存和恢复这些矩阵。

另请参阅:PushMatrix 函数。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Material mat; void OnPostRender() { if (!mat) { Debug.LogError("Please Assign a material on the inspector"); return; } GL.PushMatrix(); mat.SetPass(0); GL.LoadPixelMatrix(); GL.Color(Color.yellow); GL.Begin(GL.LINES); GL.Vertex3(0, 0, 0); GL.Vertex3(Screen.width, Screen.height, 0); GL.End(); GL.PopMatrix(); } }