I'm currently trying to make a simple square by combining two triangles, like in the tutorials by Riemer (Link to tutorial), but since a lot has changed from 3.x to 4.0, I find it difficult. I would also like to know how to texture this "square", so if anyone could help me by giving some example or whatsoever, I would appreciate it :)
Thanks!
- Basic
Here is an example XNA 4.0 program that draws a simple textured square. It requires the Green-gel-x texture (from wiki-commons - link in code) added to the content project (or replaced with your own texture). After the textured square is drawn, a wireframe square is drawn over the top so you can see the triangles. This example uses an orthographic projection and a BasicEffect instead of an effect file but is otherwise similar to the Riemer tutorial you linked to.
To perform the texturing each vertex requires a texture coordinate. For a texture that tiles once across the surface of the square the texture coordinates are (0, 0) for the top left vertex and (1, 1) for the bottom right vertex and so on. If you wanted to tile the texture across the square twice, you could set all the bottom right texture coordinates to 2, instead of 1.