-
Creator 版本 2.0.9
-
目标平台: Web / iOS / Android
我从摄像机中获取的纹理数据。代码如下。但是不知道如何把修改后的纹理同步到sprite中。
使用update方法吗?参数我不是很明白。
this.camera = this.node.getComponentInChildren(cc.Camera);
let texture = new cc.RenderTexture();
texture.initWithSize(480, 640);
const originTarget = this.camera.targetTexture;
this.camera.targetTexture = texture;
this.camera.render(this.node);
this.camera.targetTexture = originTarget;
let data = null;
texture.readPixels(data, 0,0,480, 640);
