GL
- Begin
- ClearWithSkybox
- Clear
- Color
- End
- InvalidateState
- LINES
- LoadIdentity
- LoadOrtho
- LoadPixelMatrix
- LoadProjectionMatrix
- modelview
- MultiTexCoord2
- MultiTexCoord3
- MultiTexCoord
- MultMatrix
- PopMatrix
- PushMatrix
- QUADS
- SetRevertBackfacing
- TexCoord2
- TexCoord3
- TexCoord
- TRIANGLE_STRIP
- TRIANGLES
- Vertex3
- Vertex
- Viewport
GL.PopMatrix 弹出矩阵
static function PopMatrix () : void
Description描述
Restores both projection and modelview matrices off the top of the matrix stack.
把投影视图矩阵和模型视图矩阵弹出堆栈。
Changing modelview or projection matrices overrides current camera's parameters. These matrices can be saved and restored using GL.PushMatrix and GL.PopMatrix.
改变模型视图矩阵和投影矩阵会覆盖当前的camera' 的参数,许多情况下你需要用到GL.PushMatrix 和GL.PopMatrix矩阵函数.来保存和恢复。
参见:PushMatrix 函数
using UnityEngine;
using System.Collections;
public class example : 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();
}
}
// Draw a yellow line from the botton left to the
// top right of the screen
//从屏幕左下角到右上角,绘制一条黄色的线
var mat : Material;
function OnPostRender() {
if (!mat) {
Debug.LogError("Please Assign a material on the inspector");
return;
}
GL.PushMatrix(); // Save the current state 保存当前的状态
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(); // Pop changes. 弹出改变
}
最后修改:2011年3月22日 Tuesday 14:09