modified along the changes of Chrome's WebGL implementation