Texture coordinate

From DmWiki

Textures are applied to objects using texture coordinates. Texture coordinates are associated with each vertex within a model, and indicate what point within the texture is attached to that vertex. Texture coordinates, which are 2D, are often labeled (u, v) or (s, t) to distinguish them from local or world coordinates, which are labeled (x, y, z).

Imagine a texture:

[0,0]        [1,0]
  |------------|
  |            |
  |            |
  |            |
  |            |
  |------------|
[0,1]        [1,1]

Now, the upper-left corner of that texture is said to have a texture coordinate of (0, 0), and the lower-right corner has a texture coordinate of (1, 1). The u coordinate increases as you move from left to right, and the v coordinate increases as you move from top to bottom. Note that OpenGL and Direct3D use different texture coordinate conventions. In Direct3D, the texture coordinates are (0, 0) at the top left corner, and the v coordinate increases as you move down. In OpenGL, the coordinates are called s and t instead of u and v, the (0, 0) point (the origin) is at the bottom-left corner, and the t coordinate increases as you move up.

DevMaster navigation