[]worker.js 使用问题

开启后报错如下Uncaught TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided.
    at Texture2D.__proto._createWebGlTexture (laya.d3.js:33519)
    at Texture2D.__proto.recreateResource (laya.d3.js:33562)
    at Texture2D.__proto.activeResource (laya.core.js:13234)
    at Texture2D.<anonymous> (laya.d3.js:21347)
    at Shader3D.__proto._uniform_sampler2D (laya.d3.js:28631)
    at Shader3D.__proto.uploadSpriteUniforms (laya.d3.js:28751)
    at RenderQueue.__proto._render (laya.d3.js:4070)
    at Scene.__proto._renderScene (laya.d3.js:26518)
    at Camera.__proto._renderCamera (laya.d3.js:36269)
    at Scene.__proto.renderSubmit (laya.d3.js:26982)
已邀请:

ymsdandan

赞同来自:

之前没有发生过像您这样的情况,麻烦发个例子过来我们看看可以么
 

Alex Huang

赞同来自:

这个问题,我也遇到过了。然后我改了源代码。WorkerLoader里面
__proto.imageLoaded=function(data){
        if (!data.dataType || data.dataType !="imageBitmap"){
            this.event(data.url,null);
            return;
        };
        var bitmap;
        var imageData=data.imageBitmap;
        if (Render.isWebGL){
            /*__JS__ */bitmap=HTMLImage.create(imageData.width,imageData.height,1);
            /*__JS__ */bitmap.loadImageSource(imageData);
            /*__JS__ */bitmap._setCreateURL(data.url);
        } else {
            bitmap = new HTMLCanvas(true);
            var ctx=bitmap.source.getContext("2d");
            switch (data.dataType){
                case "imageBitmap":;
                    var imageData=data.imageBitmap;
                    bitmap.size(imageData.width,imageData.height);
                    ctx.drawImage(imageData,0,0);
                    break ;
                }
            console.log("load:",data.url);
        }
        this.event(data.url,bitmap);
    }

要回复问题请先

商务合作
商务合作