[LayaAir 2.0]parameter 2 is not of type 'WebGLTexture'

微信图片_20190422215235.png

 
var htmlC:HTMLCanvas = btn_edit.drawToCanvas(btn_edit.width, btn_edit.height, 0, 0);
var interceptT:Texture = new Texture(htmlC);
var img:Sprite = new Sprite;
img.graphics.drawImage(interceptT, 0, 0, btn_edit.width, btn_edit.height);
Laya.stage.addChild(img);
 
 
如图和代码(一个按钮点击后draw图然后加入stage)
只要添加至stage后,随后就会出现这个错误,跟踪查到传入的不是WebGLTexture而是一个canvas,应该是渲染出问题
 
从2.0版本到2.0.2都有这个问题,具体项目见附件
已邀请:

yunzhongjushi

赞同来自:

花了一整天时间,跟踪了下代码,有可能是drawToCanvas或者是drawImage的时候并没有转为WebGLTexture格式导致不能渲染

要回复问题请先

商务合作
商务合作