本文整理汇总了C#中OpenGL.Light方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.Light方法的具体用法?C# OpenGL.Light怎么用?C# OpenGL.Light使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL
的用法示例。
在下文中一共展示了OpenGL.Light方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set
/// <summary>
/// This function sets all of the lights parameters into OpenGL.
/// </summary>
public virtual void Set(OpenGL gl)
{
if(on)
{
// Enable this light.
gl.Enable(glCode);
// The light is on, so set it's properties.
gl.Light(glCode, OpenGL.AMBIENT, ambient);
gl.Light(glCode, OpenGL.DIFFUSE, diffuse);
gl.Light(glCode, OpenGL.SPECULAR, specular);
gl.Light(glCode, OpenGL.POSITION, new float[] {translate.X, translate.Y, translate.Z, 1.0f});
gl.Light(glCode, OpenGL.SPOT_CUTOFF, spotCutoff);
Vertex vector = Translate - direction;
gl.Light(glCode, OpenGL.SPOT_DIRECTION, vector);
}
else
gl.Disable(glCode);
}
示例2: Bind
/// <summary>
/// This function sets all of the lights parameters into OpenGL.
/// </summary>
/// <param name="gl">The OpenGL instance.</param>
public override void Bind(OpenGL gl)
{
// Call the base (setting ambient etc).
base.Bind(gl);
// Is the light on?
if(On)
{
// Set the spot parameters.
gl.Light(GLCode, OpenGL.GL_SPOT_CUTOFF, spotCutoff);
gl.Light(GLCode, OpenGL.GL_SPOT_DIRECTION, direction);
}
}
示例3: Bind
/// <summary>
/// This function sets all of the lights parameters into OpenGL.
/// </summary>
/// <param name="gl">The OpenGL instance.</param>
public virtual void Bind(OpenGL gl)
{
if(on)
{
// Enable this light.
gl.Enable(OpenGL.GL_LIGHTING);
gl.Enable(glCode);
// The light is on, so set it's properties.
gl.Light(glCode, OpenGL.GL_AMBIENT, ambient);
gl.Light(glCode, OpenGL.GL_DIFFUSE, diffuse);
gl.Light(glCode, OpenGL.GL_SPECULAR, specular);
gl.Light(glCode, OpenGL.GL_POSITION, new float[] { position.X, position.Y, position.Z, 1.0f });
// 180 degree cutoff gives an omnidirectional light.
gl.Light(GLCode, OpenGL.GL_SPOT_CUTOFF, 180.0f);
}
else
gl.Disable(glCode);
}