【发布时间】:2019-12-20 10:36:18
【问题描述】:
我是 A-Frame 的新手,能够加载一些已加载正确纹理的 gltf 模型。我能够加载的最后一个 gltf 模型以灰色模型的形式出现,并且没有加载纹理。
现在,每当我尝试添加新的 a-entity 或几何图元时,什么都不会发生,并且元素不会出现在场景检查器中,它们也不会出现在场景中。
我正在使用 A-Frame 0.9,正在运行本地服务器,并正在使用 Google Chrome 浏览页面。我很困惑为什么我添加的元素现在不会显示出来,而我现在添加的元素与以前没有什么不同。
我尝试将新元素添加为 a-entities 以及模型或几何图元。
对于纹理,我尝试进入场景检查器并确保已为该模型加载了纹理,并且确实已加载。
这是我的身体部分
<body>
<a-scene>
<a-assets>
<img id="sky" src="sky.jpg">
<img id="courtTexture" src="NBACourt.jpg">
<img id="scoreboardTexture" src="scoreboardTextureMap.png">
<!-- <a-asset-itm id="mockCourtModel-obj" src="mockCourtforWebVR.obj"></a-asset-itm>
<a-asset-itm id="mockCourtModel-mtl" src="mockCourtforWebVR.mtl"></a-asset-itm> -->
<a-asset-item id="mockCourtglbmodel" src="mockCourt.glb">
<a-asset-item id="scoreboardglbmodel" src="scoreboard.glb">
<!-- <a-asset-item id="bleacher1glbmodel" src="bleacher.glb"> -->
<a-asset-item id="basketball" src="basketballTexture.jpg">
</a-assets>
<a-entity id="sky" geometry="primitive: sphere; radius: 3000" material="shader: flat; src: #sky; side: back"></a-entity>
<a-sphere position="0 0 0" radius=".05962739943" color="#CF5300"></a-sphere>
<!-- Lighting -->
<a-entity light="type: ambient; color: #BBB"></a-entity>
<a-entity light="type: directional; color: #FFF; intensity: 1.5" position="-0.5 1 1"></a-entity>
<a-entity gltf-model="#mockCourtglbmodel" material="src: #courtTexture" scale=".01 .01 .01"></a-entity>
<a-entity gltf-model="#scoreboardglbmodel" material="src: #scoreboardTexture" scale=".01 .01 .01" position="0 4.091 0"><a-entity>
<!-- Having a weird issue where the texture mapping isn't mapping or adding to the scoreboard correctly. -->
<!-- This bleacher model will not load -->
<!-- <a-entity gltf-model="bleacher1glbmodel" material="color: #868b94" scale=".01 .01 .01"></a-entity> -->
<a-entity id="ball" geometry="primitive: sphere; radius: .05962739943" material="shader: flat; src: #basketball"></a-entity>
我不断收到“类型错误:无法在 'WebGLRenderingContext' 上执行 'texImage2D':找不到与提供的签名匹配的函数”,并且还警告我的纹理不是 2 的幂。我有另一个纹理加载在不是 2 的幂的场景中,它仍然可以正常加载。
【问题讨论】: