Sign in to follow this  
hnim

How to manual render game object without using stage?

Recommended Posts

hi everyone, i want to manual render game object without using stage. In basic example, i didnt add bunn sprite into stage, and add render call in update (app.renderer.render(bunny)), but nothing show :(. 

here is my try: https://jsfiddle.net/7k9znhwy/3/

thanks you all

Share this post


Link to post
Share on other sites

Because Pixi Application renders Stage just after update and it hides your bunny. Look in this article: https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop , everything except "interactionManager" part is true. In your case, you'll have problem with interaction anyway.

As for rendering single elements step-by-step, @finscn is an expert on that. One of his threads: https://github.com/pixijs/pixi.js/issues/4369. Just search by his name in issues and you'll see enough material to understand that trick. However, i also recommend to read "Application" "WebGLRenderer" and "Container" class sources.

 

Share this post


Link to post
Share on other sites

Thanks for your reply. Here is my next try

1. instead of adding bunny into stage, i use a empty container:

// create a containter to add bunny
var dummyContainer = new PIXI.Container();
// add bunny
dummyContainer.addChild(bunny);

2. in update function, i call updateTransform and render manual

// manual update and render
  bunny.updateTransform();
  bunny.renderWebGL(app.renderer);

Here is full source code: https://jsfiddle.net/7k9znhwy/21/

It is ok with WebGL, but i still have same problem if application use Canvas render. Do you have any idea about this?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.