Make some improvements on gl.js

Reviewed by: Alexandre Rocha