threex.windowresize is a three.js extension to help you handle window resize.
Here is a basic example and its source. Another example with devicePixelRatio and its source
You can install it manually. Just do
<script src='threex.windowresize.js'></script>
You can install with bower.
bower install threex.windowresize
then you add that in your html
<script src="bower_components/threex.windowresize/threex.windowresize.js"></script>
You just have to instanciate the object. Then whenever you resize the window, it will resize the renderer canvas and adjust the camera accordingly.
var winResize = new THREEx.WindowResize(renderer, camera)
If you need to destroy it at one point, just do winResize.destroy();
.
It fit well with devicePixelRatio, see an example below
renderer.devicePixelRatio = 1/4
winResize.trigger()