Jump to content
  • Advertisement
Sign in to follow this  

Texture coordinates shifting with fractional vertex positions?

This topic is 2905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All,

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!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!