_drawSceneForWebGL and _drawSceneForCanvas where almost identical

The two methods were refactored.

This is like the pull request for #1187 but without the assignments to null in the canvas case, following @dingpinglv suggestions.