asny / three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)
MIT License
1.29k stars 109 forks source link

Issue when dragging window to a second monitor with different resolution #361

Closed ThomasAlban closed 11 months ago

ThomasAlban commented 1 year ago

Hi, I'm on MacOS (M1 Pro Macbook Pro). When I drag the window from one screen to another, there are weird render artefacts that can only be fixed by restarting the app and making it open on the other screen. Is there a way to fix this?

asny commented 1 year ago

Can you be a bit more specific, what kind of artifacts? Maybe post a screenshot. Also, which app are you talking about, is it a problem with the examples?

ThomasAlban commented 1 year ago

I first noticed the issue occur in an app I'm building, but it also seems to happen for the examples. When I drag the three-d window from a higher resolution screen (my macbook screen) to a lower resolution screen (a 1080p monitor) the view goes from this: image to this: image The inverse of the issue also occurs when I drag from the lower resolution screen to the higher resolution (the view becomes larger). I've since realised that the issue can be fixed by resizing the window (because that forces the camera to set its viewport). So thinking about it, this could be solved by somehow making the camera update its viewport when the window is dragged to a different screen. How would this be done?

asny commented 1 year ago

Thanks for the detailed report 👍 It looks like it's the device pixel ratio, which would make a lot of sense. Are you by any change testing on the latest release (0.15)? I think the issue might be fixed on the master branch. So can I get you to test it on master as well?