colourclash Posted February 7, 2017 Share Posted February 7, 2017 Hi, I'm having difficulty rendering a copy of a container into renderTexture when the container has some transformation. I'm aware of the transform parameter on the renderer.render method, but don't really understand how it's properly used - any enlightenment would be appreciated! Here's a fiddle which hopefully illustrates my problem http://jsfiddle.net/5mydwyxd/12/ Cheers! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 7, 2017 Share Posted February 7, 2017 Its only for x/y offset, and it has some bugs. Its suitable only for caching stuff into textures. Can you find a workaround, how not to use it? I feel like that implementation will be changed soon so its better not to depend on it. I dont understand what are you tring to achieve. Quote Link to comment Share on other sites More sharing options...
colourclash Posted February 7, 2017 Author Share Posted February 7, 2017 Okay, thanks Ivan, good to know that's work-in-progress. I guess by moving the render source to the origin before rendering e.g. http://jsfiddle.net/5mydwyxd/13/ Should be enough for now Quote Link to comment Share on other sites More sharing options...
bubamara Posted February 7, 2017 Share Posted February 7, 2017 Setting container position to 0, 0 and also having running tween ain't good. Furthermore it won't work in case you'll be rotating your container. I have updated your fiddle : http://jsfiddle.net/5mydwyxd/23/ Quote Link to comment Share on other sites More sharing options...
colourclash Posted February 8, 2017 Author Share Posted February 8, 2017 Ah, thanks! That's what I was trying to do! As a general rule, should you pass in the inverse transform of the source object to the render method?app.renderer.render(container, rt, true, container.transform.worldTransform.clone().invert()) Quote Link to comment Share on other sites More sharing options...
bubamara Posted February 8, 2017 Share Posted February 8, 2017 You're welcome. And yes to using inverse transform Quote Link to comment Share on other sites More sharing options...
colourclash Posted February 8, 2017 Author Share Posted February 8, 2017 Still having trouble applying this to my project, it seems nested containers don't play nice http://jsfiddle.net/5mydwyxd/26/ I'm looking for a reliable 'render to texture' in PIXI and not having much joy. To be specific, I have a nested container with some bitmap text in it. I'd like to render this container to a texture and use that as a sprite mask. It was working in an older version of PIXI using generateTexture method, but I'd like to use the latest PIXI version. Any ideas are most appreciated Quote Link to comment Share on other sites More sharing options...
bubamara Posted February 8, 2017 Share Posted February 8, 2017 then use localTransform instead app.renderer.render(container, rt, true, container.transform.localTransform.clone().invert()); Quote Link to comment Share on other sites More sharing options...
colourclash Posted February 9, 2017 Author Share Posted February 9, 2017 Ah, yes! Silly me that's working cool now. Thank you bubamara and Ivan! 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.