Rob Gordon Posted June 2, 2020 Share Posted June 2, 2020 There appears to be an issue with clearing the context when rendering a container to a RenderTexture while using the CanvasRenderer (PIXI-legacy v5.2.4). Consider this example:https://www.pixiplayground.com/#/edit/gM7jGSOAvFhZEeJPKeGI4 Click anywhere to toggle the visibility of one of the bunnies. Using the CanvasRenderer the context is not cleared, and the bunnies remain visible. Using the WebGL renderer (switch forceCanvas to false) this works as expected. I believe the issue may be here: if (clear !== undefined ? clear : this.clearBeforeRender) { if (this.renderingToScreen) { if (this.transparent) { context.clearRect(0, 0, this.width, this.height); } else { context.fillStyle = this._backgroundColorString; context.fillRect(0, 0, this.width, this.height); } } // else { // TODO: implement background for CanvasRenderTarget or RenderTexture? // } } The 'TODO' needs to get done. It appears there is no context management for the case where we are not renderingToScreen (as I believe is the case when we are rendering a Container to a RenderTexture). ** I've posted this to the github issues, but thought it might make sense to post it here as well to ensure that this isn't an error of understanding or implementation on my part... Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 2, 2020 Share Posted June 2, 2020 Yep, we still dont have implementation there I use custom implementation of this thing in my projects. Quote Link to comment Share on other sites More sharing options...
Rob Gordon Posted June 2, 2020 Author Share Posted June 2, 2020 Understood - though this is the kind of thing that should probably be reflected in the documentation (RenderTexture is a major feature, imo). Do you know if this is slated for the upcoming 5.3.0 release? I would think having parity between WebGL & Canvas would be critical. Anything you can share from your custom implementation? Is it as simple as removing the check for this.renderingToScreen, or will that break things? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 2, 2020 Share Posted June 2, 2020 my custom implementation is clearRect. I dont remember where is the background color /transparency setting there. I'm in my "to heck with small pixi stuff" phase, so if you want this in 5.3.0 - try make PR Really, one week before beta-release of 3-year project, I just cant do those things. Quote Link to comment Share on other sites More sharing options...
Rob Gordon Posted June 2, 2020 Author Share Posted June 2, 2020 Thanks Ivan - good luck with the release! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Rob Gordon Posted June 17, 2020 Author Share Posted June 17, 2020 Just adding a quick note that this has now been addressed in the PIXI source code: https://github.com/pixijs/pixi.js/issues/6674 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.