Skip to content

Instantly share code, notes, and snippets.

@duguying
Created January 21, 2015 07:53
Show Gist options
  • Save duguying/a13ac3156528fcc62a92 to your computer and use it in GitHub Desktop.
Save duguying/a13ac3156528fcc62a92 to your computer and use it in GitHub Desktop.
initialize webgl object
function initWebGL(canvas) {
var gl;
try {
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
}catch(e) {
return;
}
if (!gl) {
alert("Unable to initialize WebGL. Your browser may not support it.");
return;
}
return gl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment