PDA

View Full Version : Nearest texture filtering tiled texture



tksuoran
03-02-2012, 06:01 AM
I*have a 16 x 16 texture with all texels white except bottom left corner, which is black.

I draw a quad with (0.0, 0.0) .. (1.0 / 16.0, 1.0 / 16) texture coordinates in the corners with nearest min and mag filtering.

I would expect to see a black quad, but two edges have a narrow strip of white:

http://i.imgur.com/cSflZ.png

I can verify with fragment shader that all texcoord components for all pixels are < 1.0 / 16.0. Thus, I would expect "nearest" filtering to give me the black texel for all pixels. Why is this not nappening?

Edit: Subtracting 1/8192 from the 1 / 16 corner removes the white strip, while subtracting 1/8200 still leaves a few bad pixels. This is on ATI*Radeon HD 5450. However, I'd like to avoid this subtraction workaround if possible, as I was planning to pack the texcoords.