Detect software vs hardware webGL render mode

半腔热情 提交于 2019-12-11 06:57:20

问题


I've got an error I'm trying to catch with MapboxGL that doesn't handle when a version of IE switches the webGL render modes from hardware to software. I've been pouring over documentation and console logging pretty much everything I can, but can't find any documented way to find out if webGL is using hardware or software render modes.

Any ideas?


回答1:


You can check whether or not a browser can run GL JS in a hardware render mode using the mapbox-gl-supported library

<script src='mapbox-gl-supported.js'></script>
<script>
if (mapboxgl.supported({failIfMajorPerformanceCaveat: true})) {
    // hardware mode! :D
} else {
    // software mode :(
}
</script>


来源:https://stackoverflow.com/questions/41704224/detect-software-vs-hardware-webgl-render-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!