Jump to content

Access renderer from child classes


YMShen
 Share

Recommended Posts

I want to render a Graphic into a RenderTexture via `app.renderer.render(graphics, renderTexture)` but problem is the code is running from a subClass extends PIXI.Sprite.

The question is: Whether it's possible to access the renderer from child class?

After googling a while I still didn't find an answer.

Link to comment
Share on other sites

Containers don't depend on renderer, that's why its possible to render same container on multiple canvases. You have to add that dependency somehow. 

Also containers dont know about root element (will be added in pixi-v5), so you have to look at `container.parent` multiple times to get the root of your tree. Store renderer reference in the root and make a method that finds that root.

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