本文整理汇总了C#中ShaderProgram.AssertValid方法的典型用法代码示例。如果您正苦于以下问题:C# ShaderProgram.AssertValid方法的具体用法?C# ShaderProgram.AssertValid怎么用?C# ShaderProgram.AssertValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram.AssertValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialise
/// <summary>
/// Initialises the scene.
/// </summary>
/// <param name="gl">The OpenGL instance.</param>
/// <param name="width">The width of the screen.</param>
/// <param name="height">The height of the screen.</param>
public void Initialise(OpenGL gl, float width, float height)
{
// Set a blue clear colour.
gl.ClearColor(0.4f, 0.6f, 0.9f, 0.0f);
// Create the shader program.
var vertexShaderSource = ManifestResourceLoader.LoadTextFile("Shader.vert");
var fragmentShaderSource = ManifestResourceLoader.LoadTextFile("Shader.frag");
shaderProgram = new ShaderProgram();
shaderProgram.Create(gl, vertexShaderSource, fragmentShaderSource, null);
shaderProgram.BindAttributeLocation(gl, attributeIndexPosition, "in_Position");
shaderProgram.BindAttributeLocation(gl, attributeIndexColour, "in_Color");
shaderProgram.AssertValid(gl);
// Create a perspective projection matrix.
const float rads = (60.0f / 360.0f) * (float)Math.PI * 2.0f;
projectionMatrix = glm.perspective(rads, width / height, 0.1f, 100.0f);
// Create a view matrix to move us back a bit.
viewMatrix = glm.translate(new mat4(1.0f), new vec3(0.0f, 0.0f, -5.0f));
// Create a model matrix to make the model a little bigger.
modelMatrix = glm.scale(new mat4(1.0f), new vec3(2.5f));
// Now create the geometry for the square.
CreateVerticesForSquare(gl);
}