protected VertexArray(int vertexArrayId, VertexBuffer vertexBuffer, ShaderProgram shader, Texture texture, ElementBuffer elementBuffer, params VertexAttribute[] vertexAttributes) : this(vertexArrayId, vertexBuffer) { Shader.Add(shader); Textures.Add(texture); ElementBuffer = elementBuffer; _vertexAttributes.AddRange(vertexAttributes); }
public static VertexArray CreateVertexArray(ColoredTexturedVertex[] vertices, ShaderProgram shader, ElementBuffer elementBuffer, string textureFilepath, params VertexAttribute[] vertexAttributes) { var vertexArrayId = GL.GenVertexArray(); GL.BindVertexArray(vertexArrayId); var vertexBuffer = VertexBuffer.CreateVertexObject(vertices); var texture = Texture.LoadTexture(textureFilepath); var vertexArray = new VertexArray(vertexArrayId, vertexBuffer, shader, texture, elementBuffer, vertexAttributes); return(vertexArray); }
public static VertexArray CreateVertexArray(VertexBuffer vertexBuffer, ShaderProgram shader, ElementBuffer elementBuffer) { var vertexArrayId = GL.GenVertexArray(); GL.BindVertexArray(vertexArrayId); var vertexArray = new VertexArray(vertexArrayId, vertexBuffer); vertexArray.Shader.Add(shader); vertexArray.ElementBuffer = elementBuffer; return(vertexArray); }