我做了一个AFRAME AR。在我把纹理PNG。当我使用PNG从某些URL它的工作有些不PNG,当我尝试下载我的计算机上的相同PNG它确实没有工作。
为例不工作:
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
<script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script>
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs>
<a-assets>
<img id="my-texture" src="rubiscube.png">
</a-assets>
<a-entity geometry="primitive: box" material="src: #my-texture"></a-entity>
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
</body>
but like this it works:
<a-entity geometry="primitive: box" material="src: url(https://static.wixstatic.com/media/2cd43b_b13c89d3859a48129a434265b3ddd1a1~mv2_d_1826_1920_s_2.png)"></a-entity>
但图像的URL不
HTTPS://i2.我怕.com/如果V bingo.com/我怕-content/uploads/2014/04/bingo-balls-Hi-热水.PNG)">
为什么?正是这2个图像或网址,如果它工作在线URL为什么不下线为什么区别?
你必须通过一个本地服务器例如像http-server服务形象。浏览器不具备访问本地文件系统。在A-Frame FAQ更多细节