Skip to main content

History: -Pixel texel alignment

Source of version: 4 (current)

Copy to clipboard
            {INCLUDE(page="ogrelex ext tpl")/}
---
{img src="img/wiki_up/Pixel_texel_alignment.png" alt="Pixel_texel_alignment.png" imalign="right"}
D3D pixels different from D3D9 texels in that pixels have whole values at the centers, but texels have whole values at the corners. Therefore, if you do any 2D rendering that needs 1:1 pixel-texel alignment, you need to subtract 0.5 pixels from the pixel position or add 0.5 to the texel position (of course, if your texture values are in [[0..1] range, you'll need to divide 0.5 by width and/or height). This is not an issue under OpenGL because both OpenGL pixels *and* texels have whole values at the centers, so no alignment is necessary.

---
{INCLUDE(page="ogrelex ext tpl")/}
---