关于截屏没有部分不显示的问题

尝试使用如下代码进行截屏分享,结果用户头像不显示,根据代码的说明已经按照要求传递了 gl.STENCIL_INDEX8参数,结果还是不显示,请求有没有遇到同样问题的?

let node = new cc.Node();
node.setPosition(cc.visibleRect.width/2,cc.visibleRect.height/2);
node.width = cc.visibleRect.width;
node.height = cc.visibleRect.height;

node.parent = cc.director.getScene();

let camera = node.addComponent(cc.Camera);


// 设置你想要的截图内容的 cullingMask
camera.cullingMask = 0xffffffff;

// 新建一个 RenderTexture,并且设置 camera 的 targetTexture 为新建的 RenderTexture,这样 camera 的内容将会渲染到新建的 RenderTexture 中。
let texture = new cc.RenderTexture();
let gl = cc.game._renderContext;
// 如果截图内容中不包含 Mask 组件,可以不用传递第三个参数
texture.initWithSize(cc.visibleRect.width, cc.visibleRect.height, gl.STENCIL_INDEX8);
camera.targetTexture = texture;

// 渲染一次摄像机,即更新一次内容到 RenderTexture 中
cc.director.getScene().scaleY = -1;
camera.render();
cc.director.getScene().scaleY = 1;

// 这样我们就能从 RenderTexture 中获取到数据了
let data = texture.readPixels();
let width = texture.width;
let height = texture.height;

// 保存到相册
var filePath = jsb.fileUtils.getWritablePath() + picName;
console.log("filePath = " + filePath);
jsb.saveImageData(data, width, height, filePath);

求大佬关注

1.原生截图换DEPTH24_STENCIL8_OES
2.截图放到EVENT_AFTER_DRAW之后
3.1.x版本截图时关闭渲染优化剪枝功能

根据您的意见,
我将
texture.initWithSize(cc.visibleRect.width, cc.visibleRect.height, gl.STENCIL_INDEX8);
修改为
texture.initWithSize(cc.visibleRect.width, cc.visibleRect.height, gl.DEPTH24_STENCIL8_OES);

发现还是不能够截出包含mask的节点

问题已解决,在使用遮罩时候,千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万千万不要使用反向遮罩

请问,如果用了反遮罩怎么解决呢?