I'm having some trouble creating a texture from an image file in Three.js. I have a function to create a mesh that looks like this:
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);
However, my texture renders black and the image doesn't seem to render properly.