Jump to content

Creating a simple Text cache using texture from PIXI.Text


bobmartin
 Share

Recommended Posts

Hello,

I'm trying to optimise at bit my text rendering.  I render a graph, and each node in it contains an icon (from fontawesome or similar type font) and the link connecting it can display the relation name.  There is only 9 possible icons and 13 relations so it seems like a bad idea to generate 'N' PIXI.Text objects so I thought I'd try just caching the text object in a map and using its texture inside sprites then cleaning up when done.

I've ran into two problems though.

First the texture wont display unless the text is part of the scene.  If I add it as a child the Sprites will work.  If I don't they will just be empty.

Secondly, if I try to work around problem one by adding the text into the scene anyway the Sprite versions will all flicker when the text is changed (I change the text on a zoom event to scale it sharply) and not appear for a starting frame when the text is added.

Is there a way to generate the texture for a text item without adding it to the scene, and could that fix the flicker?

I forked someone elses pen to try demonstrate the text being part of the scene issue.
https://codepen.io/anon/pen/yWXMJM

I did see this project - https://github.com/JiDW/pixi-cocoontext/blob/master/src/CocoonText/index.js
But I was hoping not to have to copy all the inners of Text

Cheers
Bob

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