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_Textures - Fatal编程技术网

硬盘纹理未加载到three.js中-显示黑色

硬盘纹理未加载到three.js中-显示黑色,three.js,textures,Three.js,Textures,尝试从本地计算机加载图像时遇到问题。 如果我在互联网上给一个jpeg文件的链接,它可以正常工作,但如果我用本地机器的路径替换,纹理是黑色的 var texture = THREE.ImageUtils.loadTexture( 'http://ewgl.erbix.com/js/nodes2/textures/sun.jpg', {}, function(){ renderer.render(scene, camera); } ); paintMaterial = new THREE.MeshB

尝试从本地计算机加载图像时遇到问题。 如果我在互联网上给一个jpeg文件的链接,它可以正常工作,但如果我用本地机器的路径替换,纹理是黑色的

var texture = THREE.ImageUtils.loadTexture( 'http://ewgl.erbix.com/js/nodes2/textures/sun.jpg', {}, function(){ renderer.render(scene, camera); } );
paintMaterial = new THREE.MeshBasicMaterial({map: texture})
因此,如果我从我的机器加载相同的图像,它将显示黑色,而不是“”。 我发现在上讨论了相同的问题,但仍然无法从我的机器加载纹理

我还尝试将chrome作为chrome运行--允许从文件访问文件,然后打开链接file:///C:/Users/Anubha/Desktop/pencil/pencil.html,但paint3.jpg甚至与js和html位于同一文件夹中,显示为黑色

var texture = THREE.ImageUtils.loadTexture( 'paint3.jpg', {}, function(){ renderer.render(scene, camera); } );
        paintMaterial = new THREE.MeshBasicMaterial({color: 0x3D59AB, map: texture, specular: 0x555555, shininess: 20})
说明如何加载局部纹理