hnim Posted July 14, 2018 Share Posted July 14, 2018 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 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 14, 2018 Share Posted July 14, 2018 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. Quote Link to comment Share on other sites More sharing options...
hnim Posted July 14, 2018 Author Share Posted July 14, 2018 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? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 14, 2018 Share Posted July 14, 2018 You stilll didnt remove default pixi ticker, it still works, and "render" is still called for stage after your update method, which clears the canvas. I dont know why it works in webgl case. I'm afraid you still dont understand how Application and Renderer work. Quote Link to comment Share on other sites More sharing options...
hnim Posted July 15, 2018 Author Share Posted July 15, 2018 Ok, i got it. I override stage render function and it’s working now. Thanks you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.