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

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.