Viewport canvas size on mobile - SOLVED

This may be a bug I’m not sure.

I’m noticing that the fullscreen rectangle isn’t scaling to the proportions of my phone correctly. It appears zoomed in when portrait, And isn’t readjusting itself as expected when turning the phone portrait to landscape and vice versa. Is there anything I’m missing?

I made a short video so you can see, testing in both safari and chrome on my uptodate iPhone 7.
https://vimeo.com/keepitvisual/download/356907800/904e19d28c

and of course here’s the patch if anyone wants to have a look :slight_smile:

How this working for you? Any help welcomed.
Thanks guys

Hi KeepItVisual,
Have you tried using the width and height output from the mainloop op and not use the canvas op output ?

still no joy I’m afraid.

in the first thing you show, it works ? and then not ? what is the difference ?

i created this patch:

this works fine for me on an iphone xr, when i rotate.

the only thing: sometimes safari overlays stuff over the bottom row, but you can not control this…

does this work for you too ?

See this works perfectly for me.
I’ve noticed when an image is connected to the fullscreen rectangle and you change the viewport size it stretches and squashes as you’d expect.

When working with the render2texture node it seems to behave slightly differently. Here’s a comp to illustrate, when you make the viewport smaller, the image isn’t squashing in the same way and I’m not sure why?

the render2texture still uses the aspect ratio of the canvas.

if you add Ops.GL.Perspective op after render2texture and disable auto aspect ratio and set it to 1 it behaves the same.

we did it like that, because most of the time we want the render2texture to output an image with the same aspect ratio.
probably it would be good to add this functionality to render2texture to make it easier to adjust

1 Like

Thanks very much for this @pandur. thats exactly what I was looking for.