Recommended Posts

I seem to be getting unexpected behavior (which means I'm making an incorrect assumption I'm sure). I'm rendering a single test point sprite with a width and height of 5 pixels using an orthographic projection. I try to calculate an index based on the uv value in a fragment shader, so if the GPU is rendering the pixel with center x of 2 and y of 2, that should be the center pixel of the 5x5 sprite. I would assume the uv value would be (.4, .4). Sometimes this seems to be the case, but if for example I draw a vertex value of (8.23, 5, 5) (with a fractional x value) the uv values seem to shift such that it's not .4 anymore for the center pixel.

My final goal is to compute an index such that the middle pixel would have an index of 0, the right most of 2, and the leftmost pixel of the sprite -2, but I can't reliably do this if the uv value is shifting slightly. Thanks for any help!