Having trouble rendering nearest pixels with respect to the texture's pixel size

I’d try to add vec2(0.5) to the floored value (to get the center of the texel) before dividing by the width.
Or convert the floored value to ivec2 and use texelFetch() (instead of dividing by the width in this case).

1 Like