How exactly are textures drawn on faces of cubes?
Posted
by
Christian Frantz
on Game Development
See other posts from Game Development
or by Christian Frantz
Published on 2013-07-02T01:16:56Z
Indexed on
2013/07/02
5:14 UTC
Read the original article
Hit count: 434
Are they drawn from the lower left corner clockwise? I know how triangles are created, I'm not just sure if textures are the same way. The texture on my cube is skewed way off and after playing around with the U,V coordinates, I still can't get it right.
//front left bottom corner ok
vertices[0] = (new VertexPositionTexture(new Vector3(0, 0, 0), new Vector2(1, 0)));
//front left upper corner
vertices[1] = (new VertexPositionTexture(new Vector3(0, 1, 0), new Vector2(1, 1)));
//front right upper corner ok
vertices[2] = (new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(0, 1)));
//front lower right corner
vertices[3] = (new VertexPositionTexture(new Vector3(1, 0, 0), new Vector2(0, 0)));
//back left lower corner ok
vertices[4] = (new VertexPositionTexture(new Vector3(0, 0, -1), new Vector2(0, 1)));
//back left upper corner
vertices[5] = (new VertexPositionTexture(new Vector3(0, 1, -1), new Vector2(1, 1)));
//back right upper corner ok
vertices[6] = (new VertexPositionTexture(new Vector3(1, 1, -1), new Vector2(1, 0)));
//back right lower corner
vertices[7] = (new VertexPositionTexture(new Vector3(1, 0, -1), new Vector2(0, 0)));
© Game Development or respective owner