Load remote image and display it – #7 by muxiandong – Cocos Creator

Hi guys, I want to load remote image and display it in my game. I have refer intro to the following instructions Asset Loading · Cocos Creator.

And, I got the content about, then create Texture2D, SpriteFrame and set spriteFrame for node. But I got an error:

Uncaught TypeError: WebGLRenderingContext.texSubImage2D: Argument 7 is not valid for any of the 7-argument overloads.

Here my code:

async start () {
        let assetManager = new AssetManager();
        let remoteUrl = "http://***/image/favicon.jpeg";
        let self = this;
        assetManager.loadRemote<ImageAsset>(remoteUrl, function (err, imageAsset) {
            const spriteFrame = new SpriteFrame();
            const texture = new Texture2D();
            texture.image = imageAsset;
            spriteFrame.texture = texture;
            self.node.getComponent(Sprite).spriteFrame = spriteFrame;

Do you have solution fix it? Please help me, thank you.

Source link

More To Explore

The Germ Games – Coming Soon!

Blog/Corruption Posted Nov 6, 2021 by Martin Armstrong Spread the love Categories: Corruption, Disease Tags: Bill Gates, biowarfare, Germ Games, video « Pfizer Blackmailing Countries

Share on facebook
Share on twitter
Share on linkedin
Share on email