User uploaded textures in three.js

后端 未结 3 622
-上瘾入骨i
-上瘾入骨i 2021-01-05 20:17

Here you will find a jsFiddle adaptation of the problem.

I would like to create a 3d web application in which the user is able to select an image file on their local

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 20:30

    I also had this problem, but I had almost exact code only I was using

    var map = THREE.ImageUtils.loadTexture( e.target.result );
    

    So I had to replace that code with

    var image = document.createElement( 'img' );
    var texture = new THREE.Texture( image );
    image.onload = function()  {
        texture.needsUpdate = true;
    };
    

    and that solved the problem..

提交回复
热议问题