Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIXI.Mesh can not switcing textures on Canvas #8929

Closed
oretti opened this issue Dec 4, 2022 · 1 comment · Fixed by #8933
Closed

PIXI.Mesh can not switcing textures on Canvas #8929

oretti opened this issue Dec 4, 2022 · 1 comment · Fixed by #8933
Labels
🕷 Bug Verified that it’s actually a legit bug that exists in the current release.

Comments

@oretti
Copy link

oretti commented Dec 4, 2022

Expected Behavior

Succeed in switching textures under the following conditions.

  • use Canvas. PIXI.Application({ forceCanvas:true })
  • use PIXI.Mesh and change tint property.

Current Behavior

Can not switching textures.
(I found when using PIXI.BitmapText.)

Possible Solution

I think the following is probably the cause.

if (isTinted)
{
if (mesh._cachedTint !== mesh.tint)
{
mesh._cachedTint = mesh.tint;
mesh._cachedTexture = mesh._cachedTexture || new Texture(base);
mesh._tintedCanvas = canvasUtils.getTintedCanvas(
{ texture: mesh._cachedTexture },
mesh.tint
);
}
}

CanvasMeshRenderer caches images when changing tints, but does not re-cache images when changing textures.

Steps to Reproduce

See jsfiddle
https://jsfiddle.net/pegta1Lr/1/

  • Canvas: Image X -> X (1 sec.)
  • WebGL(Expected Behavior): Image X -> Y (1 sec.)

Environment

  • pixi.js version: v6.5.8 / v7.0.4
  • Browser & Version: Chrome 107.0.5304.123 / Firefox 107.0.1
  • OS & Version: Windows 11
@SuperSodaSea SuperSodaSea added the 🕷 Bug Verified that it’s actually a legit bug that exists in the current release. label Dec 4, 2022
@bigtimebuddy
Copy link
Member

Thank you @oretti for reporting. And the example was extremely helpful making a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕷 Bug Verified that it’s actually a legit bug that exists in the current release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants