Skip to content

Instantly share code, notes, and snippets.

@mrdoob
Created July 31, 2012 15:21
Show Gist options
  • Save mrdoob/3217776 to your computer and use it in GitHub Desktop.
Save mrdoob/3217776 to your computer and use it in GitHub Desktop.
window.addEventListener( 'resize', onWindowResize, false );
function onWindowResize() {
windowHalfX = window.innerWidth / 2;
windowHalfY = window.innerHeight / 2;
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment