= Texture mapping
<Texture mapping> associates surface locations with values sampled from an image or other texture data. In a common two-dimensional case, each vertex carries coordinates $(u,v)$ identifying a location in the texture. <Rasterization> interpolates the coordinates, and a <fragment shader> uses them to obtain a color or another surface parameter.<The OpenGL Graphics System Version 4.6 Core Profile by Khronos Group>[Chapter 8, Textures; Chapter 15, fragment-shader inputs]{ref}
For example, a square wall can use $(0,0)$, $(1,0)$, $(1,1)$ and $(0,1)$ at its corners so a rectangular image covers it once. Repeating coordinates from zero to four can tile the same image when the wrapping mode allows repetition. The mapping is separate from sampling: nearest-sample selection and interpolation can give visibly different results from identical coordinates.
When a tilted surface is viewed through <perspective projection>, equal distances on the surface need not occupy equal distances on screen. Correct interpolation must account for that projection. A texture also supplies data rather than an automatic physical material model: a stored color and the light reflected toward the camera are different quantities.
Back to article page