This Demonstration compares , ordering of pixels in a texture to -order (Morton order). The -order maps two-dimensional data to one dimension while preserving nearness of the data points. The vertical line on the right represents the order in which the pixels are stored in computer memory. The red arrow points to the color under the locator on the left. The "color range" control lets you see what part of the texture is encoded by any region of the 1D array.
Textures (images) are displayed on computer screens as 2D grids of pixels. Computer memory, however, is inherently one-dimensional, so the pixels in a texture must be ordered in some way to allow a computer to store it in memory. The standard ordering is, of course, row-by-row, column-by-column (henceforth " , ordering"), which is fine for most cases. However, it is ill-suited for a particular operation that is used often in some high-intensity situations (like HD games): accessing a rectangular region of a texture. (This is necessary if, for example, the rest of the texture is offscreen, or hidden behind something else.) If the pixels in the texture use , ordering, the computer would need to read the part of the array representing the first row of the region, then skip ahead to the second row of the region, then skip ahead to the third, and so on; that is, it would need to skip ahead once for each row in the region it wants. This skipping prevents the GPU (graphics processing unit—the computer chip that handles graphics) from taking full advantage of certain speed optimizations available to it. Thus, strategies for minimizing the need for these long jumps have been invented. They involve storing the pixels in a different order—one that tends to keep contiguous regions of the image more-or-less together, better than , ordering would.
All images used in this Demonstration are licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license, with the exceptions of "Polarlicht 2" (which is in the public domain) and "Jamnik 05" (which is licensed under the Creative Commons Attribution-Share Alike 4.0 International license).