   [.net] textured quads in XNA
  I'm trying to make textured quads in XNA but it ends up funny.  Here's my code.   public Quad(Vector3 origin, Color color, Vector3 up, float width, float height)   {  Vertices = new VertexPositionColorTexture[4];  Indices = new int[6];  Origin = origin;  this.color = color;  Up = up;  // Calculate the quad corners  Left = Vector3.Left;  UpperLeft = (Up * height / 2) + (Left * width / 2) + origin;  UpperRight = UpperLeft + Vector3.Right * width;  LowerLeft = UpperLeft + Vector3.Down * height;  LowerRight = UpperRight + Vector3.Down * height;  FillVertices();   }   private void FillVertices()   {  // Fill in texture coordinates to display full texture  // on quad  Vector2 textureUpperLeft = new Vector2(0.0f, 0.0f);  Vector2 textureUpperRight = new Vector2(1.0f, 0.0f);  Vector2 textureLowerLeft = new Vector2(0.0f, 1.0f);  Vector2 textureLowerRight = new Vector2(1.0f, 1.0f);  for (int i = 0; i < Vertices.Length; i++)  { Vertices.Color = color;  }  // Set the position and texture coordinate for each  // vertex  Vertices[0].Position = LowerLeft;  Vertices[0].TextureCoordinate = textureLowerLeft;  Vertices[1].Position = UpperLeft;  Vertices[1].TextureCoordinate = textureUpperLeft;  Vertices[2].Position = LowerRight;  Vertices[2].TextureCoordinate = textureLowerRight;  Vertices[3].Position = UpperRight;  Vertices[3].TextureCoordinate = textureUpperRight;  // Set the index buffer for each vertex, using  // clockwise winding  Indices[0] = 0;  Indices[1] = 1;  Indices[2] = 2;  Indices[3] = 2;  Indices[4] = 1;  Indices[5] = 3;   }Does anyone have any advice as to why my texture ends up looking slanted, repeated and funny and why it seems to be wider than it ought to.   
  Your vertex winding order and texture coordinates seem fine, but I can't make heads or tails of how you're calculating the vertex positions.  It looks quite strange, and if incorrect would result in an incorrectly shaped and sized quad.  I'd suggest taking a hard look at it and maybe simplifying the code.[Edited by - gharen2 on February 2, 2008 1:14:12 PM];  Actually I did notice an error but I don't think it would cause my error.basically the error is that I'm setting the origin to be at the center no matter what I send it.  So I need to fix that but otherwise if I send 1 x 90 then upperLeft is (-.5, 45, z) upperright is (.5, 45, z) and likewise for the lowerhalves with 45 now being negative.  Is it the case that vertices can't be negative?What's a working quard vertice order?Thanks for your help.   ;  I think the way your calculate your quad corners would break if you pass anything other than Vector3.Up into the up parameter into the Quad method.   ;  After taking another look, I see what you're trying to do.One problem I see in your code is that you're supplying an up vector, yet using Vector3.Down in some places in your code.  Instead of Vector3.Down, use -up.Try the following (this code is untested):UpperLeft = origin;UpperRight = origin + (Vector3.Right * width);LowerLeft = origin + (-up * height);LowerRight = origin + (Vector3.Right * width) + (-up * height);Thus, the upper left corner of the quad is it's origin point.[Edited by - gharen2 on February 2, 2008 2:17:54 PM]