daPhyre/webgl-lessons — pull request #1 by greggman (2014-01-19 01:25:47+00:00)
Title: Remove gl.viewportWidth and gl.viewportHeight

The original code setup to user properties on the WebGLRenderingContext
call `gl.viewportWidth` and `gl.viewportHeight`. The issue with these
are (1) they end up looking like part of the WebGL spec which is
confusing for new users and (2) they are not live so they need to be
updated if the canvas changes size.

Instead I changed them to `gl.canvas.width` and `gl.canvas.height`
where appropriate. Also for the perspective matrix I changed them
to `gl.canvas.clientWidth` and `gl.canvas.clientHeight` which
means they'll be correct even if the display size of the canvas
does not match the size of the canvas' backing store. For example
if the canvas is sized using CSS.