Recommended Posts

I'm in the process of expirementing with the creation of a C++ 2D engine and am having some fustrations dealing with texture offsets for sprites. Currently I'm loading a texture from an image which has four 32x32 boxes in a row (128x32). Then jumping down the road abit I set the texture coordinates for a square like this:
left = (1.0f/fFullTextureWidth)*(float)m_rectTexture.left;
right = (1.0f/fFullTextureWidth)*(float)m_rectTexture.right;
So for example if the texture width is 128 and m_rectTexture.left is 32 and m_rectTexture.right is 64, left will be 0.5 and right will be 0.75.
This all works perfectly for the sprites with a scale of x = 1, y = 1. But if I change it to say: 1.5 and 1.5, I get a vertical line of 1 pixel width from the previous 32x32 square. Stangely, if I set x scaling to 1.5, and y to 1, it'll work just fine without any "bleeding". Various scalings will work fine such as 2 and 2, but others won't.
How do I fix this? Is there a way to "bind" the UV coordinates to ensure nothing outside of them is used (though I thought that was the entire point of UV coordinates).
Thanks in advance. If I get a really helpful answer, I may be willing to "donate" some funds ;)