【发布时间】:2014-09-23 22:00:17
【问题描述】:
我在 Three.js 中从图像文件创建纹理时遇到了一些问题。我有一个函数可以创建一个看起来像这样的网格:
var image = document.createElement('img');
image.src = imageFile;
var texture = new THREE.Texture(image);
var mat = new THREE.MeshPhongMaterial();
mat.map = texture;
var mesh = new THREE.Mesh(new THREE.PlaneGeometry(20, 20), mat);
var plane = mesh;
plane.position.x = 0;
scene.add(plane);
但是,我的纹理呈现黑色,图像似乎无法正确呈现。
【问题讨论】:
标签: javascript three.js textures