I have a seamless Texture2D with GL_REPEAT and few triangles to which this texture is mapped correctly.
for each vertex in these triangles i'm updating positionX to move this texture as parallax background and it gets large values.
u = positionX/texture_width; v = positionY/texture_height;
Problem is that when u <~50 , everything works fine, texture is repeating, but after it reach some limit it starts to display something like lower resolution texture and after every X distance it's getting worse.
How could I properly limit this u & v to smaller values ?
I have tried simply for each vertex to limit u this way
float pWsp = positionX/(pTextureWidth);
float pResult = pWsp - ((int)pWsp);
return pResult;
but every time texture ends is reversed int X which gives me strange result
You are running into precision problems with the texture coordinates. As the integer part increases in magnitude, there is less precision left in the fractional part, and you start to see artifacts.
As you have observed, you cannot fix this per-vertex, as you will get wrapping problems where vertices of a single triangle will end up having the correction applied inconsistently.
You need to apply the correction uniformly to whole polygons. The best place to do this is in the source data - break it up into chunks such that none of the texture coordinates gets too large.