Original Post
please help me I been getting this error for weeks, cant find out how to fix this.
CustomVertex.TransformedColored[] vertices=new CustomVertex.TransformedColored[3];
vertices[0].Position = new Vector4(150f, 100f, 0f, 1f);
vertices[0].Color = Color.Red.ToArgb();
vertices[1].Position = new Vector4(this.Width/2+100f, 100f, 0f, 1f);
vertices[1].Color = Color.Green.ToArgb();
vertices[2].Position = new Vector4(250f, 300f, 0f, 1f);
vertices[2].Color = Color.Yellow.ToArgb();
device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0);
device.BeginScene();
Player1.Draw();
device.VertexFormat = CustomVertex.TransformedColored.Format;
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, vertices);
device.EndScene();
device.Present();
and I get this error when the code gets to this line. device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, vertices); this is the error I get. An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in Microsoft.DirectX.Direct3D.dll Additional information: Error in the application.