Second Texture is not displayed - but black screen

I found this 2 years ago - I don’t know why . but it works as expected (I cannot explain why it has THREE.MeshBasicMaterial but no mesh as in sphere geometry)

texture = new THREE.TextureLoader().load(previewdir + pano1);
texture.mapping = THREE.EquirectangularReflectionMapping;
material = new THREE.MeshBasicMaterial({
map: texture
});

tw = 0;
scene.background = texture;

loader = new THREE.TextureLoader().load(megadir + pano1, texture => {
texture.mapping = THREE.EquirectangularReflectionMapping;
scene.background = texture;
scene.background.needsUpdate = true;
});

anyway - what I want to achieve is:
after 10 seconds - when Pano1 Texture is rotating on the screen i want to load a replacement texture
Pano2 Texture like this

loader2 = new THREE.TextureLoader().load(megadir + pano2, texture => {
texture2.mapping = THREE.EquirectangularReflectionMapping;
});

and after 2 Minutes the Pano2 Texture shall replace Pano1 Texture

scene.background = texture2;
scene.background.needsUpdate = true;

But the only thing I get is a black screen which is obviously rotating - its not a crash
Because if I switch back after 4 Minutes as planned to Pano1 texture it still works BUT not as expected Instead of Hires Pano1 The Lowres Preview Texture of Pano1 is displayed - don’t know why this is not overwritten in the variable texture

:wink: I worked with easier software 20 years ago - I could assign 4 textures to a terrain by only setting 4 pointers - I wonder why everything is so complicated with THREE - :joy:

update ur threejs to the release 141

Can you manage to demonstrate this issue with a live example? Edit fiddle - JSFiddle - Code Playground

Ok - It works until version r132

r133 shows the same as r141

r133

  • Move TextGeometry, FontLoader and Font to examples. #22560 (@Mugen87)

I updated to 132 - with 141 the fontloader etc. is not working anymore

But I managed to swap textures - bugs in my code (solved as it seems)
I changed it to
material.map = texture2;
material.needsUpdate=true;
scene.background.needsUpdate = true;
scene.background = texture2;
and it works