blendModes override masks?
in
Programming Questions
•
5 months ago
Is this a bug? Or just a basic color math concept I'm missing?
I have a PImage with a mask that draws correctly.
When I change the blendMode the mask disappears, except for ADD.
This holds true when I'm using P2D, P3D, and even when the PImage is mapped onto 3D geometry.
Is there any way to combine masks and blendingModes?
Thanks,
--David
Here's my code. I've used loadImage, but it works the same way with generated PImages:
I have a PImage with a mask that draws correctly.
When I change the blendMode the mask disappears, except for ADD.
This holds true when I'm using P2D, P3D, and even when the PImage is mapped onto 3D geometry.
Is there any way to combine masks and blendingModes?
Thanks,
--David
Here's my code. I've used loadImage, but it works the same way with generated PImages:
- PImage image, mask;
boolean bMask = false;
void setup() {
size(800, 800, P2D);
image = loadImage("fibers.jpg");
mask = loadImage("zebra.jpg");
}
void draw() {
background(128);
blendMode(ADD);
image(image, 0, 0);
}
void keyPressed()
{
if(key == 'm') {
if(!bMask) {
image.mask(mask);
bMask = true;
print(bMask);
}
else {
image = loadImage("fibers.jpg");
bMask = false;
print(bMask);
}
}
}
1