Skip to content

[p5.js 2.0 Bug Report]: WebGL tint() with alpha blows out colors #7768

@davepagurek

Description

@davepagurek

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.0.0

Web browser and version

Firefox

Operating system

MacOS

Steps to reproduce this

Steps:

  1. Load an image
  2. Use WebGL mode
  3. Apply a tint with alpha, e.g. tint(255, 50)
  4. Draw the image

The image's colours get blown out. e.g. with no tint:

Image

With tint(255, 50):

Image

Snippet:

let img

async function setup() {
  createCanvas(400, 400, WEBGL)
  img = await loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Brown_paper_bag_texture.jpg/960px-Brown_paper_bag_texture.jpg?20161026200514')
}

function draw() {
  background(220)
  imageMode(CENTER)
  tint(255, 50)
  image(img, 0, 0, width, height)
}

Live: https://editor.p5js.org/davepagurek/sketches/Cljuh6uQM

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions