Texture Coords to Texel Location
Want to convert from (s,t) space to (u,v) space.
- texture coordinates to texel location
Take fractional part of Texture Coordinate, multiply by 2K, and drop rest of fraction.
- multiply by 2K is shift to left by K
Assume a 64 x 32 texture map (26 x 25)
- Let texture coordinates be (0.5, 0.75)
- Texel Coordinates will then be
- u = 0.8000H << 6 = 0x20 = 32
- v = 0.C000H << 5 = 0x18 = 24