Created
January 21, 2015 07:53
-
-
Save duguying/a13ac3156528fcc62a92 to your computer and use it in GitHub Desktop.
initialize webgl object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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