The image loading is asynchronous.
What is happening is that your single render()
call is occurring before the image finishes loading.
Enter
renderer.render(scene, camera);
into the Console, and you will see that the texture renders.
You need to add a callback to your loadTexture()
function and call render()
from there, or, alternatively, you can add an animation loop using requestAnimationFrame()
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…