Skip to content

Instantly share code, notes, and snippets.

@bsy
Created July 11, 2014 00:18
Show Gist options
  • Save bsy/d4379adeb7b0837bd6a2 to your computer and use it in GitHub Desktop.
Save bsy/d4379adeb7b0837bd6a2 to your computer and use it in GitHub Desktop.
Obtain GPU card info
<script>
var canvas = document.createElement('canvas');
canvas.setAttribute("id", "gltestcanvas");
gl = null;
try {
// Try to grab the standard context. If it fails, fallback to experimental.
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
}
catch(e) {
console.warn(e);
}
if (gl) {
var ext = gl.getExtension('WEBGL_debug_renderer_info');
if(ext) {
console.log(gl.getParameter(ext.UNMASKED_RENDERER_WEBGL));
LYT.GoogleAnalytics.trackEvent("WebApp", "GLInfo", {label: "GPU", value: gl.getParameter(ext.UNMASKED_RENDERER_WEBGL)});
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment