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.Vertex 顶点
static function Vertex (v : Vector3) : void
Description描述
Submit a vertex.
绘制一个顶点。
In OpenGL this matches glVertex3f(v.x,v.y,v.z); on other graphics APIs the same functionality is emulated.
这个函数和OpenGL中的glVertex3f(v.x,v.y,v.z)函数一样。其它的图形API也有对应的功能。
This function can only be called between GL.Begin and GL.End functions.
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.LoadOrtho();
GL.Begin(GL.LINES);
GL.Vertex(new Vector3(1, 0, 0));
GL.Vertex(new Vector3(0, 1, 0));
GL.End();
GL.PopMatrix();
}
}
// Draws a line from the bottom right
// to the top left of the Screen
// Using GL.Vertex
//从屏幕的左下角到右上角绘制一条对角线
var mat : Material;
function OnPostRender() {
if (!mat) {
Debug.LogError("Please Assign a material on the inspector");
return;
}
GL.PushMatrix();
mat.SetPass(0);
GL.LoadOrtho();
GL.Begin(GL.LINES);
GL.Vertex(Vector3(1,0,0));
GL.Vertex(Vector3(0,1,0));
GL.End();
GL.PopMatrix();
}
最后修改:2011年3月21日 Monday 13:06