Is it possible to use a 2d canvas as a texture for a cube?

后端 未结 1 606
我在风中等你
我在风中等你 2020-12-20 04:02

I want to add images to one face of a cube, possibly using a 2d canvas element as the face texture. Here is my code, but I can\'t get the result I want. The face using the c

1条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-20 05:00

    The texture.needsUpdate is probably being set too early. Try this:

    var texture = new THREE.Texture(canvas);
    
    image0.onload = function() {
        context.drawImage(image0, 0, 0);
        texture.needsUpdate = true;
    };
    image0.src = 'textures/nx.jpg';
    

    0 讨论(0)
提交回复
热议问题