SFML community forums
Help => Graphics => Topic started by: Shadow Kitsune on February 07, 2022, 03:23:54 pm
-
Ok so when I move my sprite, sometimes the pixels get smaller and wider in width. Just a little bit.
It only happens when the view is resized(I resize it by factor of 1.2 or 0.8). Question is - Can I somehow get rid of that behavior?
-
Render on integer/pixel coordinates and don't scale your view (or only scale it by factors of 2).
The issue is once you tell OpenGL to render something that is smaller than a pixel, it has to do some interpolation and decide how it should render this small pixel, which then can lead to behavior as described.
By sticking to integer coordinates, OpenGL doesn't have to interpolate, and no unwanted distortions appear.
Some effects can be mitigated with a render texture that is used before rendering to the screen, but it won't solve everything.
-
Well yes, but I need to scale it by some float factor in order to match resolution, or I would need to work on 320 x 180 window to scale it properly using int values.
Or am I doing something wrong in here and need to rework my resolution system?