title: Resize viewport/canvas according to browser window size
body: <p>I want my webgl app viewport and canvas to react to browser window size changes (that includes F11 button). I.e. I want the canvas to be always 100% width and height and I want the viewport size and aspect ratio to be appropriate. The former I achieve with simple:</p>
  
  <pre><code>&lt;canvas style="width: 100%; height:100%;"&gt;
  </code></pre>
  
  <p>although I'm not sure if that's the way to go. The latter I was trying to achieve with some information I found here: <a href="https://stackoverflow.com/questions/11819768/webgl-gl-viewport-change">Webgl gl.viewport change</a> but obviously I'm doing something wrong. I do realize:</p>
  
  <pre><code>canvas.onresize = resizeViewport;
  </code></pre>
  
  <p>is wrong as canvas's size doesn't change very often (it's always 100% width and height) but I don't know how I should do it.</p>
  
  <p>Here's an online version of the app: <a href="http://nps.netarteria.pl/gallery" rel="noreferrer">http://nps.netarteria.pl/gallery</a>.</p>