If you want to repeat the texture n times on each face.
Set the texture addressing mode to the WRAP mode
Set the texture coordinates as below for each face of the box.
A(0, 0) B(n, 0) ------------------- | | | | | | | | | | | | | | D(0, n) ------------------- C(n, n)
Here is the code example, I am using native DirectX, take vertex B for example, it's position is (5.0, 5.0, 0), and the texture coordinate is(0, 4.0f), so the texture repeat 4 times across u direction.
// Vertex layout
struct Vertex
{
float x, y, z ; // Position
float u, v ; // Texture coordinates
};
Vertex FrontFace[] =
{
{-5.0f, 5.0f, 0, 0, 0}, // Vertex A
{ 5.0f, 5.0f, 0, 4.0f, 0}, // B
{ 5.0f, -5.0f, 0, 4.0f, 4.0f}, // C
{ 5.0f, -5.0f, 0, 4.0f, 0}, // D
} ;
Typically, the u- and v-texture coordinates that you assign to a vertex are in the range of 0.0 to 1.0 inclusive. However, by assigning texture coordinates outside that range, you can create certain special texturing effects.
see Texture Addressing Mode for details. this is for native DirectX, but you can simply apply it in C#.