public ProgramUniform Uniform(string name) { if (name == null) { throw new ArgumentNullException("name"); } ProgramUniform uni = _uniforms.FirstOrDefault(a => a.Name == name); if (uni == null) { throw new ArgumentException(string.Format("Uniform not found: {0}", name), "name"); } return(uni); }
internal void MapUniforms() { int count = 0; GL.GetProgram(_id, ProgramParameter.ActiveUniforms, out count); _uniforms.Clear(); for (int i = 0; i < count; i++) { int size; ActiveUniformType type; string name = GL.GetActiveUniform(_id, i, out size, out type); int slot = GL.GetUniformLocation(_id, name); ProgramUniform attribute = new ProgramUniform(name, slot, size, type); _uniforms.Add(attribute); } }