当前位置: 首页>>代码示例>>C#>>正文


C# ShaderProgram.IsActiveUniform方法代码示例

本文整理汇总了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);
			}
		}
开发者ID:rhynodegreat,项目名称:OpenGL.Net,代码行数:36,代码来源:LineState.cs


注:本文中的ShaderProgram.IsActiveUniform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。