I tried searching for an answer to this but didn’t find anything, hope I didn’t miss anything obvious. I also posted the question on SO before realising this forum existed
I’d like to find an efficient way to resize the canvas to match the size of the browser window, without resizing or scaling the contents of the canvas – ie. if I’m displaying an object that takes up all of the viewport in fullscreen, when reducing the window it shouldn’t be entirely visible anymore.
Right, now, I’m doing this:
Then, on init and resize:
camera.fov = window.innerHeight / window.screen.height; camera.aspect = window.innerWidth / window.innerHeight; renderer.setViewport(0, 0, window.innerWidth, window.innerHeight);
Which works, but I’m just not sure it’s the proper way to do it. Mainly I’m concerned that it’s wasteful if the user is only ever using a tiny window – are all the contents of a full-size canvas still ‘computed’, or does
setViewport avoid that?