Jump to content

How does the renderer work?


mkersche
 Share

Recommended Posts

I am using a PIXI.WebGLRenderer and calling its render method on my stage which renders everything that is a child of the stage.

 

Does this method loose efficiency if the stage has children that are off screen? Should I be removing objects that have gone off the screen so the renderer doesnt try to draw them or is the renderer smart enough not to draw that object?

 

I am making a game with a tiled map and I want to know if I should be removing the tiles from the stage when they have scrolled off screen and then add them back when we go back to that part of the map or does it not matter?

 

thank you

Link to comment
Share on other sites

Pixi performs no object culling for you at all, so you need to implement this yourself - as yes, the more objects in the scene (visible or not) the more impact it has on performance.

 

 

That is very true! I had many problems with performance of my game loop since I wanted to have many cool visual effects. 

 

I CANNOT UNDERESTIMATE how big performance boost I had after not rendering objects that are offscreen.

 

My advice to you is to use visible false property on sprites or displayObjectContainers. 

 

Under the hood this is one of the initial checks the engine makes before rendering and you can simply turn the object on with one line of code (if removed you would have to re-instantianate it agian, as well invisible objects can change position in your game loop).

 

 

http://www.sevenative.com

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