【发布时间】:2020-10-12 13:52:29
【问题描述】:
我正在尝试将图像添加到我的场景中,其中 src 指向资产标签内的项目之一:
<a-assets>
<a-asset-item id="shoot" src="/assets/icons/shoot.png"></a-asset-item>
</a-assets>
...
<a-image src="#shoot"
position="0 0 -0.2"
scale="0.05 0.05 0.05"
material="alphaTest: 0.5"></a-image>
...
我在控制台中收到以下错误:
THREE.WebGLState: TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Overload resolution failed.
at Object.texImage2D (aframe-master.js:27470)
at uploadTexture (aframe-master.js:28387)
at setTexture2D (aframe-master.js:27939)
at WebGLTextures.safeSetTexture2D (aframe-master.js:28819)
at SingleUniform.setValueT1 [as setValue] (aframe-master.js:23479)
at Function.WebGLUniforms.upload (aframe-master.js:23938)
at setProgram (aframe-master.js:32143)
at WebGLRenderer.renderBufferDirect (aframe-master.js:30878)
at renderObject (aframe-master.js:31625)
at renderObjects (aframe-master.js:31595)
at WebGLRenderer.render (aframe-master.js:31376)
at HTMLElement.render (aframe-master.js:79612)
at bound (aframe-master.js:83391)
at onAnimationFrame (aframe-master.js:31231)
at onAnimationFrame (aframe-master.js:21566)
我也尝试过以这种方式加载它,但它不起作用:
<a-assets>
<a-asset-item id="shoot" src="/assets/icons/shoot.png"></a-asset-item>
</a-assets>
<a-image src="/assets/icons/shoot.png"
position="0 0 -0.2"
scale="0.05 0.05 0.05"
material="alphaTest: 0.5"></a-image>
但如果我删除一个资产项,它会起作用:
<a-image src="/assets/icons/shoot.png"
position="0 0 -0.2"
scale="0.05 0.05 0.05"
material="alphaTest: 0.5"></a-image>
你能告诉我我做错了什么吗?是bug吗?
【问题讨论】:
-
没有运行和调试的代码将很难提供帮助。与glitch.com/~aframe分享简单的可运行代码,帮助人们帮助你
标签: aframe