言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

GL.Color

public static function Color(c: Color): void;

Description

現在の頂点カラーを設定します

これはOpenGLでの glColor4f(c.r,c.g,c.b,c.a); と同じような 機能性を持つものです。 頂点ごとのカラーを異なるハードウェアで確実に動作させるには、 カラーチャンネルをバインドするシェーダーを使用する必要があります。 詳しくはBindChannelsを参照してください。 この関数はGL.BeginとGL.End関数の間で呼び出すことができます。

	// Draws a red line from the bottom right
	// to the top left of the Screen
	// And a yellow line from the bottom 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();
		mat.SetPass(0);
		GL.LoadOrtho();
		GL.Begin(GL.LINES);
		GL.Color(Color.red);
		GL.Vertex3(1,0,0);
		GL.Vertex3(0,1,0);
		GL.Color(Color.yellow);
		GL.Vertex3(0,0,0);
		GL.Vertex3(1,1,0);
		GL.End();
		GL.PopMatrix();
	}