Skip to content

Instantly share code, notes, and snippets.

@lizheming

lizheming/gl.html

Created Jul 6, 2017
Embed
What would you like to do?
Detect iPhone Mode
<!-- https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/HardwareGPUInformation/HardwareGPUInformation.html -->
<!doctype html>
<html>
<body>
<canvas id="glcanvas" width="0" height="0"></canvas>
<script type="text/JavaScript">
var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};
var canvas;
canvas = document.getElementById("glcanvas");
var gl = canvas.getContext("experimental-webgl");
//document.write(gl.getParameter(gl.RENDERER) + "<br>");
//document.write(gl.getParameter(gl.VENDOR) + "<br>");
// document.write(getUnmaskedInfo(gl).vendor + "<br>");
document.write('Your GPU is ' + getUnmaskedInfo(gl).renderer + "<br>");
function getUnmaskedInfo(gl) {
var unMaskedInfo = {
renderer: '',
vendor: ''
};
var dbgRenderInfo = gl.getExtension("WEBGL_debug_renderer_info");
if (dbgRenderInfo != null) {
unMaskedInfo.renderer = gl.getParameter(dbgRenderInfo.UNMASKED_RENDERER_WEBGL);
unMaskedInfo.vendor = gl.getParameter(dbgRenderInfo.UNMASKED_VENDOR_WEBGL);
}
return unMaskedInfo;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.