问题
I have been trying to load textures for a WebGL application in a Chrome browser in an Android device
I came across a similar post THREE.js - Can't load texture locally where a solution to load textures is given for Chrome which works only on a PC/laptop device
The flag --allow-file-access-from-files works on a laptop device as I can use the command line but how to do it on a mobile device?
Can someone please help with this?
回答1:
The Crosswalk projects embeds a Chromium webview and, by standard, will allow the loading of textures and models from files.You can compile your demo with Crosswalk by using this if you have a blacklisted gpu: make_apk.py --package=org.crosswalkproject.yourproject \ --manifest=your_webgl_demo/manifest.json --xwalk-command-line='--ignore-gpu-blacklist'
The last part isn't necessary if your gpu supports webgl completely. If you have problems though, replace the last part with --xwalk-command-line='--disable-web-security' which will give you total access to files (with all the risks involved).
But the simplest method is to use a webserver on android to access files from 127.0.0.1:8080. There are many free webservers on the playstore and I use them on a daily basis to test webgl demos on my device.
来源:https://stackoverflow.com/questions/26521338/three-js-cannot-load-texture-locally-in-chrome-browser-in-android-device