Hi,
What are the options to copy a RenderTexture to a Texture2D in Cocos creator 3.4.2 apart from reading pixels using readPixels() function and making an ImageAsset?
I have employed the method shown below, but this seems to be working slow.
The code below reads the pixels from 6 render targets and creates 6 Texture2D using the data.
for(let i: number = 0; i < 6; i++)
{
let pixelsArr: ArrayBufferView = this.cubeSidesRT[i].readPixels(0, 0, this.cubeSidesRT[i].width, this.cubeSidesRT[i].height);
this.imageAssets[i].reset({
_data: pixelsArr,
width: this.cubeSidesRT[i].width,
height: this.cubeSidesRT[i].height,
format: Texture2D.PixelFormat.RGBA8888,
_compressed: false
});
this.cubeSidesTex[i].image = this.imageAssets[i];
}