Jump to content

Problems with renderTexture in PIXI4 - texture is not visible


Daevid66
 Share

Recommended Posts

Hi, I'm trying to migrate a quite large project to PIXI 4, and has managed to get most of it running fine.

I have one issue still though, and have tried to reproduce it here:

http://codepen.io/anon/pen/VmXPGa?editors=0010

What I do in the example:

1. create a container and add three graphics objects (circles)

2. create a renderTexture, and render the conatiner to it.

3. create a sprite and with the new renderTexture (this is shown correctly)

4. create a new renderTexture and render the sprite to it

5. create a new sprite with the new renderTexture

The last sprite is invisible... When looking at the data for the textures they look the same, so I guess it's the actual bitmap that is incorrect.

In my larger project I can sometimes see flickering artifacts od the texture in wrong places, indicating that the rendered texture might be shared between different sprites.

Has anyone seen anything similar?

/David

 

 

Link to comment
Share on other sites

OK, I think I get it now. I have offset the the image so that it is drawn outside the texture. Makes sense, I will solve my problem by creating a helper function that:

- gets the bounds of the target

- save parent

- create a new container, and move it to compensate for the targets position

- re-parent to previous parent

Cheers,

/David

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