Skip to content

RenderTexture.draw with tint: red/blue values inverted #5509

@anthonygood

Description

@anthonygood

Version

  • Phaser Version: v3.51.0-FB
  • Operating system: MacOS 11.1 (Big Sur)

Description

Looks similar to this issue (which was apparently fixed): #3643

Example Test Code

When I use sprite.setTint(0xff0000), the sprite is tinted red as expected:

image

However, when drawing the frame to a render texture with renderTexture.draw(frame, 0, 0, 1, 0xff0000), the texture is tinted blue:
image

I added a crude function to swap the red and blue values, and the output looks correct:

export const invertRB = (colour: number) => {
  const [r,g,b] = colour.toString(16).padStart(6, '0').match(/[\w]{2}/g);
  return parseInt([b,g,r].join(''), 16);
}

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions