Problem on understanding how to use `renderer.copyTextureToTexture`

Demo URL

I’ve tried to use renderer.copyTextureToTexture with many of texture combinations.

It’s always throwing me the error.

Uncaught TypeError: Failed to execute 'texSubImage2D' on 'WebGL2RenderingContext': Overload resolution failed.

Am I missing something prerequisite to using this method?

You have to wait until the source and destination textures are fully loaded so the Texture.image property is not null. copyTextureToTexture() assumes texture data are copied to an existing (not uninitialized) texture.

Besides, texture are not created like so: const texture1 = new THREE.Texture(10, 10);.

This is no valid signature. First parameter is an image, second one is the mapping.