Render the camera immediately

Hi. I`m using cocos creator 3.3.2, moved from 2.4.3.

My game used and cc.RenderTexture.readPixels() to generate some kind of snapshot of screen. But that methods were disappeared at 3.3.2.

I`ve noticed about 3.4.0 and cc.RenderTexture.readPixels() returns, but how can I render the camera immediately, like

Pls help. Thanks.

I can ask engineering to have a look.

You can refer to :CococsCreator-public-technology-solutions/Screenshot2D.ts at 3.4.0-release · cocos-creator/CococsCreator-public-technology-solutions · GitHub

Hi linrm, thanks for help.

Your solution looks that reads frame buffer from persistent( but not main ) camera, and It requires 2 frames at least, using cc.Component.scheduleOnce.

Can I render some node just in time, like cc.Camera.render()? any alternatives?


You can render in time, the solution capture in 2 seconds later because it needs time to prepare webgl.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.