How to initialise WebGL
From The WebGL Cookbook
WebGL content is displayed in an HTML canvas element. Use the following code to get a WebGL context for a given canvas.
var gl;
function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
gl.viewport(0, 0, canvas.width, canvas.height);
} catch(e) {
}
if (!gl) {
alert("Could not initialise WebGL, sorry :-(");
}
}
