检测软件与硬件WebGL渲染模式 [英] Detect software vs hardware webGL render mode

查看:145
本文介绍了检测软件与硬件WebGL渲染模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用MapboxGL捕获一个错误,当一个版本的IE将webGL渲染模式从硬件切换到软件时,该错误无法处理.我一直在浏览文档和控制台日志,几乎可以做所有事情,但是找不到任何文档的方式来确定webGL是使用硬件还是软件渲染模式.

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.

有什么想法吗?

推荐答案

您可以使用

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>

这篇关于检测软件与硬件WebGL渲染模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆