Pixi.js: Rendering updated canvas to texture

Created on 22 May 2014  路  6Comments  路  Source: pixijs/pixi.js

Hi,

I have been having difficulties rendering updated canvas onto the texture.
I am basically drawing video/camera feed onto the canvas and then want to render canvas as a Sprite. After looking into #435 #430 I still have not achieved any success.

code :

function init(){
base = new PIXI.BaseTexture( canvas ); //that's the html canvas
texture = PIXI.Texture.fromCanvas(base);
sprite = new PIXI.Sprite( texture );
}

function update(){
PIXI.texturesToUpdate.push(base);
}

Thanks for any advice!

Most helpful comment

@GoodBoyDigital Are you sure? People should be using the sprite.texture.update() methods, not the old dirty flags I'm pretty sure...actually, I'm almost positive (since I wrote it lol)...

Edit: Realized that the comment Mat made was a long time ago :P latest dev is now v3, which you should use the texture update method!!

All 6 comments

hi there! in the latest dev version you should be able to try setting the baseTextures _dirty property.

base._dirty[0] = true;

let me know if this works for ya!

Doesn't work.

sprite.baseTexture._dirty[0] = true works for me

@GoodBoyDigital Are you sure? People should be using the sprite.texture.update() methods, not the old dirty flags I'm pretty sure...actually, I'm almost positive (since I wrote it lol)...

Edit: Realized that the comment Mat made was a long time ago :P latest dev is now v3, which you should use the texture update method!!

sprite.texture.update(), after load texture lels me!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gaccob picture gaccob  路  3Comments

lucap86 picture lucap86  路  3Comments

samueller picture samueller  路  3Comments

SebastienFPRousseau picture SebastienFPRousseau  路  3Comments

courtneyvigo picture courtneyvigo  路  3Comments