gpt4 book ai didi

html - Google VR View 错误 - 无法从 ffff.jpg 加载纹理

转载 作者:技术小花猫 更新时间:2023-10-29 12:55:08 24 4
gpt4 key购买 nike

这是我的 index.html 文件

<html>
<head>
<title>VR Sample</title>
<script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>

</head>

<body>

<div id="vrview">
<iframe width="100%"
height="300px"
allowfullscreen
frameborder="0"
src="http://storage.googleapis.com/vrview/index.html?image=ffff.jpg&is_stereo=true">
</iframe>
</div>



</body>
</html>

这是网站文件夹的结构

我尝试按照 google 代码实验室中的说明将其托管在 chrome 的网络服务器中。但是我点击了 127.0.0.1.8887 url,我得到了一个没有文件或文件夹的空白页面。然后我尝试在 XAMPP 上托管它并且它确实有效。但是,我没有得到全景图像。相反,我得到了这个错误

enter image description here

我使用谷歌相机应用程序拍摄了 360 度图像,并使用谷歌的在线转换器将其转换为立体图像,但出现了同样的错误。我还尝试从 github 下载 VRView 存储库并将代码修改为

src="vrview/index.html?image=ffff.jpg&is_stereo=true"

那也行不通。

最佳答案

您使用的是 iframe 版本的 vrview,意思是当您请求“ffff.jpg”时,您实际上是在请求:

http://storage.googleapis.com/ffff.jpg

尝试使用javascript版本

试试这个:

<html>
<head>
<script src="http://storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
<script>
window.addEventListener('load', onVrViewLoad);

function onVrViewLoad() {
var vrView = new VRView.Player('#vrview', {
image: 'http://storage.googleapis.com/vrview/examples/coral.jpg',
is_stereo: true,
width: '100%',
height: 300
});
}
</script>
</head>
<body>
<div id="vrview"></div>
</body>
</html>

注意:chrome 无法访问硬盘上的文件。

编辑:这是由于CORS .

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.

感谢@Eleanor Zimmermann 注意到这一点。

关于html - Google VR View 错误 - 无法从 ffff.jpg 加载纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41485184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com