private void OnCreateVertexBuffer(object sender, System.EventArgs e)
{
VertexBuffer buffer = (VertexBuffer)sender;
CustomVertex.PositionTextured[] verts = new CustomVertex.PositionTextured[4];
verts[0].Position = new Vector3(0, 0, 1f);
verts[1].Position = new Vector3(0.25f, 0, 1f);
verts[2].Position = new Vector3(0.25f, -0.25f, 1f);
verts[3].Position = new Vector3(0, -0.25f, 1f);
verts[0].Tu = 0; verts[0].Tv = 0;
verts[1].Tu = 0.25f; verts[1].Tv = 0;
verts[2].Tu = 0.25f; verts[2].Tv = 1;
verts[3].Tu = 0; verts[3].Tv = 1;
buffer.SetData(verts, 0, LockFlags.None);
}
Unfortunately, whenever I run the program, it simply displays the entire image file squeezed into a small square space, instead of the square section that I asked for. What am I doing wrong?
Note: The only reason I do not wish to use many separate image files is because I plan on expanding the image file to include many different textures, and having a folder filled with small image files is going to leave a big mess.