private void CreateIndexBuffer(Veldrid.GraphicsDevice graphicsDevice) { ushort[] quadIndices = { 0, 1, 2, 3 }; _indexBuffer = graphicsDevice.ResourceFactory.CreateBuffer(new Veldrid.BufferDescription( (uint)(quadIndices.Length * sizeof(ushort)), Veldrid.BufferUsage.IndexBuffer )); graphicsDevice.UpdateBuffer(_indexBuffer, 0, quadIndices); }
private void CreateVertexBuffer(Veldrid.GraphicsDevice graphicsDevice) { ImageVertex[] quadVertices = { new ImageVertex(new Vector2(-1f, 1f), new Vector2(0,0)), new ImageVertex(new Vector2(1f, 1f), new Vector2(1,0)), new ImageVertex(new Vector2(-1f, -1f), new Vector2(0,1)), new ImageVertex(new Vector2(1f, -1f), new Vector2(1,1)) }; _vertexBuffer = graphicsDevice.ResourceFactory.CreateBuffer(new Veldrid.BufferDescription( (uint)(quadVertices.Length * Marshal.SizeOf(new ImageVertex())), Veldrid.BufferUsage.VertexBuffer )); graphicsDevice.UpdateBuffer(_vertexBuffer, 0, quadVertices); }