[LayaAir 2.0]3d文字在浏览器能正常运行,打包后使用时会报错
错误:Failed to execute "texImage2D" on "WebGL2RenderingContext":No function was found that matched the signature provided
在this.texture2D.loadImageSource(this.cav);报错
this.cav = Laya.Browser.createElement("canvas");
this.cav.width = 256;
this.cav.height = 256;
var cxt = this.cav.getContext("2d");
cxt.fillStyle = 'rgb(' + '220' + ',' + '5' + ',5)';
cxt.font = "bold 50px 宋体";
cxt.textAlign = "center";//文本的对齐方式
cxt.textBaseline = "center";//文本相对于起点的位置
//设置文字,位置
cxt.fillText("-" + hart.toString(), 100, 50, 200);//有填充cxt.font="bold 60px 宋体";
this.texture2D = new Laya.Texture2D(256, 256);
this.texture2D.loadImageSource(this.cav);
this.mat.renderMode = Laya.UnlitMaterial.RENDERMODE_TRANSPARENT;
this.mat.albedoTexture = this.texture2D;
this.plane.meshRenderer.sharedMaterial.cull = Laya.RenderState.CULL_NONE;
在this.texture2D.loadImageSource(this.cav);报错
this.cav = Laya.Browser.createElement("canvas");
this.cav.width = 256;
this.cav.height = 256;
var cxt = this.cav.getContext("2d");
cxt.fillStyle = 'rgb(' + '220' + ',' + '5' + ',5)';
cxt.font = "bold 50px 宋体";
cxt.textAlign = "center";//文本的对齐方式
cxt.textBaseline = "center";//文本相对于起点的位置
//设置文字,位置
cxt.fillText("-" + hart.toString(), 100, 50, 200);//有填充cxt.font="bold 60px 宋体";
this.texture2D = new Laya.Texture2D(256, 256);
this.texture2D.loadImageSource(this.cav);
this.mat.renderMode = Laya.UnlitMaterial.RENDERMODE_TRANSPARENT;
this.mat.albedoTexture = this.texture2D;
this.plane.meshRenderer.sharedMaterial.cull = Laya.RenderState.CULL_NONE;
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复