public void Initialise(OpenGL gl) { const uint positionAttribute = 0; const uint normalAttribute = 1; var attributeLocations = new Dictionary <uint, string> { { positionAttribute, "Position" }, { normalAttribute, "Normal" }, }; // Create the per pixel shader. shaderPerPixel = new ShaderProgram(); shaderPerPixel.Create(gl, ManifestResourceLoader.LoadTextFile(@"Shaders\PerPixel.vert"), ManifestResourceLoader.LoadTextFile(@"Shaders\PerPixel.frag"), attributeLocations); // Create the toon shader. shaderToon = new ShaderProgram(); shaderToon.Create(gl, ManifestResourceLoader.LoadTextFile(@"Shaders\Toon.vert"), ManifestResourceLoader.LoadTextFile(@"Shaders\Toon.frag"), attributeLocations); // Generate the geometry and it's buffers. trefoilKnot.GenerateGeometry(gl, positionAttribute, normalAttribute); }
public void Initialise(OpenGL gl) { // We're going to specify the attribute locations for the position and normal, // so that we can force both shaders to explicitly have the same locations. const uint positionAttribute = 0; const uint normalAttribute = 1; var attributeLocations = new Dictionary <uint, string> { { positionAttribute, "Position" }, { normalAttribute, "Normal" }, }; // Create the per pixel shader. shaderPerPixel = new ShaderProgram(); shaderPerPixel.Create(gl, ManifestResourceLoader.LoadTextFile(@"Shaders\PerPixel.vert"), ManifestResourceLoader.LoadTextFile(@"Shaders\PerPixel.frag"), attributeLocations); // Create the toon shader. shaderToon = new ShaderProgram(); shaderToon.Create(gl, ManifestResourceLoader.LoadTextFile(@"Shaders\Toon.vert"), ManifestResourceLoader.LoadTextFile(@"Shaders\Toon.frag"), attributeLocations); // Generate the geometry and it's buffers. trefoilKnot.GenerateGeometry(gl, positionAttribute, normalAttribute); }