Fixed #1615 Let WebGL render code separate from Canvas render code

Let WebGL render code separate from Canvas render code