Error creating triangles

Oct 26, 2009 at 4:35 PM

Hello,

I am trying to make a quad using 4 triangles, instead of 2. I am defining 5 vertices. 0(1,1,0). 1(0,0,0), 2(-1,1,0), 3(1,-1,0), 4(-1,-1,0)

When a use the fourth vertex, like

public void InitMesh()
{
_ptBuffer1.Clear();
_ptBuffer2.Clear();
_triangleIndices.Clear();
_textureIndices.Clear();

_ptBuffer1.Add(new Point3D(1, 1, 0));
_ptBuffer1.Add(new Point3D(0, 0, 0));
_ptBuffer1.Add(new Point3D(-1, 1, 0));


_ptBuffer1.Add(new Point3D(1, -1, 0));

_ptBuffer1.Add(new Point3D(-1, -1, 0));


_triangleIndices.Add(0);
_triangleIndices.Add(1);
_triangleIndices.Add(2);


_triangleIndices.Add(3);
_triangleIndices.Add(1);
_triangleIndices.Add(0);


_triangleIndices.Add(3);
_triangleIndices.Add(1);
_triangleIndices.Add(4);


I am getting an ArgumentOutofRangeException ... =( I don't know why. Can someone help me?

Regards,

Jose