Or in the tutorial,
sprites and textures, mention that textures whose host shape (or I presume sprite) have a position that is in between pixels (i.e. a float position) can cause intended behaviour of a failed render of a working texture IntRect
as stated elsewhere on this forum:
It's not a bug, this is the intended behaviour. It happens when your sprite is at decimal coordinates.
It seems odd this tutorial doesn't mention this problem despite recommending animation sheets and tilesets, which is where this problem is made obvious.
Two sample pictures of before and after I made a workaround in my program of defining position and size as Vector2i and inserting that into a Vector2f constructor before creating my shapes:
All of the above errors are due to the rendering taking pixels from adjacent pixels to those I specified.
Whilst my workaround is easy, if peculiar looking for doing sf::Vector2f(sf::Vector2i(x, y)), it took a long time to realise my code wasn't positioning wrongly, it wasn't magically modifying the IntRect for the texture rectangle, but it was intended behaviour. It would also appear that normally generated shapes with SFML, without a texture, are unaffected.
This is neither simple (you have to ignore giving decimal coordinates despite them being defined only as a float in setter functions), common behaviour (textureless shapes, what you use to build up your program before adding textures, are unaffected) nor expected behaviour for anyone new to the scene (the tutorial isn't intended for anyone who is intimately familiar with OpenGL or how your library talks to it). So I would at least like a mention in the tutorial if not
also an overloaded function for Vector2i to represent a perfectly valid way to not cause any further issues that doesn't rely on "free pixels" between textures on the sprite sheet as that does not solve pixel bleeding.
I imagine you need coordinates/size to be defined as a float for some reason, despite this flaw and what is probably an odd quirk given that there is no pixel 0.5 0.5 on my monitor, which is why I'm not requesting replacing existing behaviour.
It was even said at the time in the linked thread:
Is the behavior already mentioned somewhere in the documentation/tutorials or do you think it occurs too rarely?
It is mentioned in the tutorials that don't exist yet
So I think, given that was posted in 2012, 7 years is long enough to wait for a few sentences in one tutorial.