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

blendMode() not working in WebGL mode #5793

Closed
2 of 17 tasks
davepagurek opened this issue Sep 8, 2022 · 2 comments · Fixed by #5794
Closed
2 of 17 tasks

blendMode() not working in WebGL mode #5793

davepagurek opened this issue Sep 8, 2022 · 2 comments · Fixed by #5794

Comments

@davepagurek
Copy link
Contributor

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
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.4.2

Web browser and version

Firefox 104.0.1

Operating System

MacOS 12.5.3

Steps to reproduce this

Steps:

  • Set blendMode to something non default (e.g. MULTIPLY)
  • Change from 2D mode to WebGL mode
  • Overlapping colours don't blend the same way

Snippet:

WebGL
function setup() {
  createCanvas(400, 400, WEBGL);
}

function draw() {
  background(255);
  
  blendMode(MULTIPLY);
  
  noStroke();
  
  fill('red');
  circle(-width/4, -height/4, width);
  
  fill('blue');
  circle(width/4, height/4, width);
}

image

2D
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(255);
  translate(width/2, height/2);
  
  blendMode(MULTIPLY);
  
  noStroke();
  
  fill('red');
  circle(-width/4, -height/4, width);
  
  fill('blue');
  circle(width/4, height/4, width);
}

image

@davepagurek
Copy link
Contributor Author

It looks like manually calling drawingContext.enable(drawingContext.BLEND) fixes this. Maybe something should be setting this internally

@davepagurek davepagurek self-assigned this Sep 9, 2022
@Qianqianye
Copy link
Contributor

This might also relate to issue #4562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants