following the code on WebGL Beginner's guide