Jump to content

Can PIXI generate textures with not rendered property changes?


Eugenius
 Share

Recommended Posts

Hello guys! 

 

Here is short code example

 

doc = new PIXI.DisplayObjectContainer();

/*

draw something on the doc

*/

spr = new PIXI.Sprite(doc.generateTexture());

stage.addChild(spr);

renderer.render(stage);

 

this is how we normally create sprite out of DOC.

 

but what I'd like to do is

 

doc = new PIXI.DisplayObjectContainer();

/*

draw something on the doc

*/

doc.scale.x = 2;

doc.scale.y = 2;

spr = new PIXI.Sprite(doc.generateTexture());

stage.addChild(spr);

renderer.render(stage);

 

that the sprite is drawn out of scaled doc even I did not render it before generating the texture. 

 

My application contains a lot of Graphics and DOCs and rendering one frame takes around 200ms to render at some levels. So I'd like to cache some of the levels that have many objects at the start of the application. 

 

little example for a better explanation

level 1 - 1000 objects (takes a few ms to render)

level 2 - 60000 objects (disaster)

and I need animation from level 1 to level 2. 

 

cacheAsBitmap may not be an option for me because transition from level 1 to 2 will be very slow unless it's already cached but it starts from level 1, so i cannot cache the level 2 before I actually render it on the screen.

 

is there any buffer option I can use?

 

Thanks for reading!

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...