Having some difficulty with creating a texture from an image file using Three.js. Currently, attempting to create a mesh using the following function:
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);
Encountering an issue where the texture renders black and the image does not display correctly.