https://docs.cocos.com/creator/manual/zh/render/camera.html#截图
按官网的文档, 执行到
// 渲染一次摄像机,即更新一次内容到 RenderTexture 中
camera.render();
会报错
Cannot read property ‘_assembler’ of null
https://docs.cocos.com/creator/manual/zh/render/camera.html#截图
按官网的文档, 执行到
// 渲染一次摄像机,即更新一次内容到 RenderTexture 中
camera.render();
会报错
Cannot read property ‘_assembler’ of null
我之前分享截图到微信用这个,你看看行不行。
var offsetTop = 100;
var offsetX = 40
var canvas = cc.game.canvas;
var width = cc.winSize.width;
var height = cc.winSize.height;
canvas.toTempFilePath({
x: offsetX,
y: offsetTop,
width: width-offsetX,
height: height-offsetTop,
destWidth: width-offsetX,
destHeight: height-offsetTop,
success (res) {
//.可以保存该截屏图片
param.imageUrl = res.tempFilePath;
wx.shareAppMessage(param);
}
})