When using the SMAAPass, a warning is logged:
THREE.WebGLRenderer: Texture marked for update but image is incomplete
This warning occurs because the Image.complete
is false, after setting Image.complete
it looks like it is asynchronous.
Please also include a live example if possible. You can start from these templates:
You're right. A simple fix could look like the following code section. Ideally it would be place after this line in SMAAPass
:
var self = this;
setTimeout( function () {
// assigning data to HTMLImageElement.src is asynchronous (see #15162)
// using setTimeout() avoids the warning "Texture marked for update but image is incomplete"
self.searchTexture.needsUpdate = true;
self.areaTexture.needsUpdate = true;
}, 0 );
Would you like to do a PR with the changes?
That looks like a hack to me. Please consider a more conventional pattern:
var image = new Image();
image.src = dataURL;
var texture = new THREE.Texture( image );
image.onload = function () {
texture.needsUpdate = true;
};
Indeed, that's nicer 👍
I will change it to onload callbacks.
Most helpful comment
That looks like a hack to me. Please consider a more conventional pattern: