We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › PImage.mask() and OPENGL
Page Index Toggle Pages: 1
PImage.mask() and OPENGL (Read 2416 times)
PImage.mask() and OPENGL
May 4th, 2005, 6:26am
 
when a masked PImage is drawn before (draw order) and in front of (translate z) another object, the PImage's matte is drawn opaque over the other object.

Code:

import processing.opengl.*;

PImage img, imgAlpha;

void setup () {
size (400, 400, OPENGL);

img = loadImage("image0.gif");
imgAlpha = loadImage("alpha0.gif");
img.mask(imgAlpha);

stroke(250);
fill(150);
}

void draw () {
background(0, 0, 50);

pushMatrix();
translate(0, 0, 0);
image(img, 50, 50, 200, 200);
popMatrix();

//if rect is drawn after (draw() order) and behind (z depth) alpha masked image,
//alpha mask works incorrectly
pushMatrix();
translate(0, 0, -1);
rect(150, 150, 200, 200);
popMatrix();
}


workaround is to either draw masked PImage after or behind other objects.

example images:
http://transmote.com/share/p5/alpha0.gif
http://transmote.com/share/p5/image0.gif

this is with winXP, v0087.
Re: PImage.mask() and OPENGL
Reply #1 - May 4th, 2005, 5:58pm
 
not really a bug, this is just the way opengl works, unfortunately. i'll add it to the known issues page.

in the future we might have support for first z-ordering all the polygons so that this situation can be avoided, but it hasn't been implemented/tested yet.
Re: PImage.mask() and OPENGL
Reply #2 - Oct 15th, 2005, 7:28pm
 
now tracking this issue here:
http://dev.processing.org/bugs/show_bug.cgi?id=176
Page Index Toggle Pages: 1