I am trying to update a THREE.Texture
".image" property with an HTML5 canvas object. This works on Chromium (MacOSX) on my laptop. However, iPhone Safari and iPhone Chrome both does not work. What could be the root cause and how to fix this?
Using Web Inspector in Safari, I get this error message:
WebGL: INVALID_VALUE: texImage2D: no canvas.
I made sure the canvas is completely drawn before being updated, using the below code to update the material:
material.map.image = loaded_canvas[curr_id]; // loaded_canvas stores canvas that has been completed loaded already, drawn by Image() objects.
material.map.needsUpdate = true;
Here is how material is used:
var geometry = new THREE.SphereGeometry(100.0, 32, 32);
var material = new THREE.MeshBasicMaterial({
map: THREE.ImageUtils.loadTexture(image_path),
side: THREE.BackSide,
});
Strangely, if I use THREE.ImageUtils.loadTexture
to load an image, it works fine. However, my use case is that I have to use an canvas object (multiple images on a canvas).
Thanks.