linux下配置WebGL
0. 参考
- 在 Linux 中安装 Firefox :https://support.mozilla.org/zh-CN/kb/linux-firefox
- Linux下离线安装Google Chrome: https://blog.csdn.net/ancientapesman/article/details/118340178
- webgl无法正常运行: https://blog.csdn.net/deleteelf/article/details/7376296
- 在 Ubuntu 下开启 Chrome 的 WebGL 功能(开启 GPU 加速):https://my.oschina.net/noahxiao/blog/146018
1. linux下配置WebGL
环境都是离线的,不能联网。
1.1 Windows
1.1.1 Chrome
- 右键Chrome浏览器,属性
- 在”目标“项后边添加以下内容:–enable-webgl --ignore-gpu-blacklist --allow-file-access-from-files
完整的内容类似以下:
C:\Users\rongda3\AppData\Local\Google\Chrome\Application\chrome.exe --enable-webgl --ignore-gpu-blacklist --allow-file-access-from-files - 说明:
–enable-webgl :表示开启WebGL支持
–ignore-gpu-blacklist :表示忽略GPU黑名单,也就是说有一些显卡GPU因为过于陈旧等原因,不建议运行WebGL,这个参数可以让浏览器忽略这个黑名单,强制运行WebGL
–allow-file-access-from-files :表示允许从本地载入资源,如果你不是WebGL的开发者,不需要开发调试WebGL,只是想要看一下WebGL的Demo,那你可以不添加这个参数
1.1.2 Firefox
- 打开浏览器,输入:about:config
- 在过滤器(filter)中搜索“webgl”
将webgl.force-enabled设置为true - 将webgl.disabled设置为false
- 在过滤器(filter)中搜索“security.fileuri.strict_origin_policy”
将security.fileuri.strict_origin_policy设置为false
1.2 Centos
1.2.1 Chrome
1.2.1.1. 安装chrome
下载安装包 google-chrome-stable_current_x86_64.rpm,下载地址:https://www.google.cn/chrome/
下载最新版:google-chrome-stable_current_x86_64.rpm
下载其他依赖项
下载地址:https://rpmfind.net/linux/rpm2html/search.php
下载项:
vulkan-filesystem-1.1.97.0-1.el7.noarch.rpm
vulkan-1.1.97.0-1.el7.x86_64.rpm
iberation-narrow-fonts-1.07.2-16.el7.noarch.rpm
liberation-fonts-1.07.2-16.el7.noarch.rpm
开始安装
sudo rpm -ivh vulkan-filesystem-1.1.97.0-1.el7.noarch.rpm
sudo rpm -ivh vulkan-1.1.97.0-1.el7.x86_64.rpm
sudo rpm -ivh liberation-narrow-fonts-1.07.2-16.el7.noarch.rpm
sudo rpm -ivh liberation-fonts-1.07.2-16.el7.noarch.rpm
sudo rpm -ivh google-chrome-stable_current_x86_64.rpm
- 配置chrome的WebGL
进入chrome,输入:chrome://gpu/ 查看 GPU 状态
出现Hardware accelerated 证明是开启的
开启GPU加速:输入:chrome://flags/,找到 Override software rendering list,设置为Enabled,点击 Relaunch Now,重启
修改配置文件
sudo vi /usr/share/applications/google-chrome.desktop
# 找到Exec=开头的行,改行指定Chrome的启动命令,修改为
Exec=/usr/bin/google-chrome-stable --ignore-gpu-blacklist --enable-webgl --no-sandbox %U
1.2.2 FireFox
这里只是在普通用户下测试使用,所以没有卸载默认安装的FireFox。
1.2.2.1 安装最新版FireFox
下载新版FireFox,下载地址:https://support.mozilla.org/zh-CN/kb/linux-firefox
上传文件后解压缩
tar xjf firefox-*.tar.bz2
创建一个桌面快捷方式
ln -s ~/firefox/firefox ~/Desktop/
1.2.2.2 配置
配置和windows下一样