Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Three.js 三个,为什么“;纹理标记为更新,但图像不完整”;?_Three.js - Fatal编程技术网

Three.js 三个,为什么“;纹理标记为更新,但图像不完整”;?

Three.js 三个,为什么“;纹理标记为更新,但图像不完整”;?,three.js,Three.js,我使用256*256像素的png作为纹理,geometry.vertices也是256*256。 它发出警告“纹理标记为更新,但图像不完整”。 也许我不明白“不完整”的意思。 谢谢您的回复。我不知道您是如何加载纹理的。所以这只是我的猜测 我可以在setTexture2D中看到这一行 } else if ( image.complete === false ) { console.warn( 'THREE.WebGLRenderer: Texture marked for update b

我使用256*256像素的png作为纹理,geometry.vertices也是256*256。 它发出警告“纹理标记为更新,但图像不完整”。 也许我不明白“不完整”的意思。
谢谢您的回复。

我不知道您是如何加载纹理的。所以这只是我的猜测

我可以在setTexture2D中看到这一行

} else if ( image.complete === false ) {
    console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete', texture );
} else {
我想您的纹理图像尚未加载。你是如何加载图像的?如果您像下面这样加载texture.image,而不处理image.onload以等待使用它,直到它被正确地放入内存,我想可能会发生此警告

var texture = new Texture();
texture.image = new Image();
document.body.appendChild(texture.image);
texture.image.src = "http://......../texture.png";

如果是这样,我建议改用THREE.TextureLoader,并确保在使用之前加载纹理。

我不知道如何加载纹理。所以这只是我的猜测

我可以在setTexture2D中看到这一行

} else if ( image.complete === false ) {
    console.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete', texture );
} else {
我想您的纹理图像尚未加载。你是如何加载图像的?如果您像下面这样加载texture.image,而不处理image.onload以等待使用它,直到它被正确地放入内存,我想可能会发生此警告

var texture = new Texture();
texture.image = new Image();
document.body.appendChild(texture.image);
texture.image.src = "http://......../texture.png";
如果是这样,我建议改为使用THREE.TextureLoader,并确保在使用它之前加载纹理