public static VertexShader Compile(GraphicsContext graphics, string source) { if (source == null) throw new ArgumentNullException("source"); VertexShader shader = new VertexShader(graphics); Shader.Compile<VertexShader>(shader, source); return shader; }
public ShaderProgram(GraphicsContext graphics, VertexShader vertexShader, FragmentShader fragmentShader) : base(graphics) { if (vertexShader == null) throw new ArgumentNullException("vertexShader"); if (fragmentShader == null) throw new ArgumentNullException("fragmentShader"); this.Handle = this.Graphics.GL.CreateProgram(); this.vertexShader = vertexShader; this.Graphics.GL.AttachShader(this.Handle, this.vertexShader.Handle); this.fragmentShader = fragmentShader; this.Graphics.GL.AttachShader(this.Handle, this.fragmentShader.Handle); this.Graphics.GL.LinkProgram(this.Handle); this.uniformLocations = new Dictionary<string, int>(); }