Page 1 of 1

Virtual Resolution Management

Posted: Fri Apr 13, 2018 2:47 pm
by franfox
Hi everyone,

I'm doing the CS50's youtube courses and in the early chapter 1 I've noticed that a simply task, like a make two images to scroll in parallax, is giving me a glitchy result. As you could see in the file attached, the background image is making some glitch while moving (you could see more clearly at the end on image).

I think is related to the Push library so I've tried to do it manually and I can't see this behavior. So I want to ask you guys if to manage the virtual resolutions are you using this library or another and why do you think this glitch happens.

Thanks!
bird.love.zip
(7.06 KiB) Downloaded 105 times

Re: Virtual Resolution Management

Posted: Fri Apr 13, 2018 3:57 pm
by pgimeno
I can't see any glitch.

Re: Virtual Resolution Management

Posted: Fri Apr 13, 2018 4:03 pm
by franfox
pgimeno wrote: Fri Apr 13, 2018 3:57 pm I can't see any glitch.
Maybe it's a bit subtle but when the mountains are moving you can see isn't a soft movement, also you can notice it at the end of the image (when the screen goes black)

Re: Virtual Resolution Management

Posted: Sat Apr 14, 2018 4:01 pm
by ReFreezed
I do see one glitch - not sure if it's the same as what you're seeing.
Fifty Bird glitch.png
Fifty Bird glitch.png (24.27 KiB) Viewed 3777 times
I've highlighted the issue which reminds me of screen tearing caused by Vsync, but it's happening diagonally. I've looked at the code and it seems to happen when the canvas (or "virtual screen") is drawn to the actual screen at 250% scale (which is what the game starts in if you don't resize the window). When resizing the window the glitch usually disappears but not at all window sizes.

Maybe there's a rounding issue somewhere in LÖVE or OpenGL, as I don't find anything weird in the push library that would cause this. All push is doing is allowing you to draw to a canvas which is then drawn to the screen at a certain position and with a certain scale. It's weird.

Re: Virtual Resolution Management

Posted: Sat Apr 14, 2018 6:45 pm
by pgimeno
Ah, I could see it by taking a snapshot. Thanks, ReFreezed. Indeed it looks like a rounding problem. That triangle is most likely the dividing line between the upper and the lower triangle of the quad (rectangles are drawn as two triangles).

I guess the main problem is the 50% part of the 250%. Rounding errors are more visible at the halves. I've had trouble drawing regular images at or near positions with a decimal part of 0.5.

https://bitbucket.org/rude/love/issues/ ... ing-images

Anyway, unless you work with integral multiples, those rounding errors are likely to appear.

Re: Virtual Resolution Management

Posted: Sun Apr 15, 2018 1:05 pm
by franfox
Thanks guys! It's true you can solve the problem changing the display size to any virtual sizer round variations (x2, x3, x4) and not the current scale.