/// <summary> /// Binds this texture as uniform into texture slot 0. Texture must be bound. /// </summary> /// <param name="pipeline">The shader used for drawing</param> public void Set(ShaderPipeline pipeline) { if (pipeline == null) { throw new ArgumentNullException(nameof(pipeline)); } Gl.ActiveTexture(TextureUnit.Texture0); Bind(); Gl.Uniform1(pipeline.GetUniformLocation(name), 0); Unbind(); }
/// <summary> /// Create a new vertex array object /// </summary> /// <param name="buffer">The buffer the metadata applies to. Does not need to be bound.</param> /// <param name="pipeline">The shader pipeline for the drawing operation.</param> /// <param name="attributes">Vertex attribute definitions</param> public VertexArrayObject(VertexArrayBuffer <T> buffer, ShaderPipeline pipeline, params VertexAttributeDescription[] attributes) { if (attributes == null || buffer == null || pipeline == null) { throw new ArgumentNullException(); } this.buffer = buffer; Handle = Gl.GenVertexArray(); Verify.VerifyResourceCreated(Handle); this.pipeline = pipeline; Bind(); buffer.Bind(); foreach (var attr in attributes) { SetAttribute(attr); } Unbind(); buffer.Unbind(); }