本文整理汇总了C#中ShaderProgram.IsActiveUniform方法的典型用法代码示例。如果您正苦于以下问题:C# ShaderProgram.IsActiveUniform方法的具体用法?C# ShaderProgram.IsActiveUniform怎么用?C# ShaderProgram.IsActiveUniform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram.IsActiveUniform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyState
/// <summary>
/// Set LineState state.
/// </summary>
/// <param name="ctx">
/// A <see cref="GraphicsContext"/> which has defined the shader program <paramref name="shaderProgram"/>.
/// </param>
/// <param name="shaderProgram">
/// The <see cref="ShaderProgram"/> which has the state set.
/// </param>
public override void ApplyState(GraphicsContext ctx, ShaderProgram shaderProgram)
{
if (ctx == null)
throw new ArgumentNullException("ctx");
Debug.Assert(Width >= 0.0f);
Debug.Assert(!String.IsNullOrEmpty(UniformName));
// Set the line width
if ((ctx.IsCompatibleProfile == true) || (shaderProgram == null) || (_Width <= 1.0)) {
float[] validRange = ctx.Caps.Limits.AliasedLineWidthRange;
float actualWidth = Math.Max(validRange[0], Math.Min(_Width, validRange[1]));
// LineWidth shall be called in the case drawing in immediate mode, or when no shader program
// is bound or when the line width is less than 1.0f
Gl.LineWidth(actualWidth);
} else if ((shaderProgram != null) && (shaderProgram.IsActiveUniform(UniformName) == true)) {
// Note that the width is not clamped in the higher boundary.
// In forward compatibility profiles, it is not possible to draw lines with a width greater than 1.0f; this
// mean that 'shaderProgram' possibly setup a geometry shader that takes the responsability of drawing a
// line with a width greater than 1.0f
shaderProgram.SetUniform(ctx, UniformName, _Width);
}
}