Jump to content

RenderTexture is not working in canvas base


tywang2006
 Share

Recommended Posts

I did some code here

 

this._iconSprite = GameAsset.icons[id];
        this._iconSprite.x = (this.symbolWidth - this._iconSprite.width) / 2;
        this._iconSprite.y = (this.symbolHeight - this._iconSprite.height) / 2 - offset;
        this._renderer.render(this._iconSprite, this._renderTexture, true);

Link to comment
Share on other sites

We'll fix that issue anyway, but the time spent on it depends on how much information you give us. If you need it RIGHT NOW, please convert it to pixiv4 code first and confirm that its not working properly in our examples page http://pixijs.github.io/pixi-examples-v2/#/basics/render-texture.js

Link to comment
Share on other sites


PIXI.loader.add('../assets/icons/icons.json').load(onAssetLoaded);
function onAssetLoaded(loader:any, resource:any):void {
    let renderer:any = new PIXI.CanvasRenderer(600, 600);
    renderer.backgroundColor = 0x000000;
    window.document.body.appendChild(renderer.view);
    var sprite = new PIXI.Sprite(PIXI.Texture.fromFrame('icon0'));
    var spriteNew = new PIXI.Sprite();
    spriteNew.texture = PIXI.RenderTexture.create(sprite.width, sprite.height);
    var stage = new PIXI.Container();
    stage.addChild(spriteNew);
    function render() {
        spriteNew.x+=1;
        sprite.x+=0.1;
        renderer.render(sprite,spriteNew.texture);
        renderer.render(stage);
        requestAnimationFrame(render);
    }
    render();
}

i can duplicate it with above code

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...