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.
Page Index Toggle Pages: 1
Mask? (Read 888 times)
Mask?
Oct 12th, 2005, 12:44pm
 
Hmm,

obviously there is something special about openGL and mask. I found some threads where people have problems using mask in OPENGL, so do I.
Unfortunately I couldnt find a solution of how to get this to work, which is common workaround to have semi-transparent masks over images in openGL?
Re: Mask?
Reply #1 - Oct 12th, 2005, 3:53pm
 
perhaps be more specific / post some code that doesn't work?

be sure to call updatePixels() on an image after using mask(), this should probably be done by mask() itself but may not be at the current time.
Re: Mask?
Reply #2 - Oct 12th, 2005, 5:21pm
 
Hi,

please check out:
http://www.dr3.de/tmp/mask_test.zip

The code is the following:
Code:

import processing.opengl.*;

int[] maske;
PImage img;
PImage imgBgr;

void setup()
{
size(200,150, OPENGL); // WORKS IN P3D!
framerate(120);
maske = new int[width*height];
img = loadImage("pic.jpg");
imgBgr = loadImage("test.jpg");

for(int i=0;i<width*height;i++)
maske[i] = 0;
}

void draw()
{
image(imgBgr,0,0);

img.mask(maske);
img.updatePixels();
image(img, 0, 0);
}

void mouseMoved()
{
maske[constrain( int( (mouseY-1)*width + mouseX), 0, width*height)] = 255;
}



So I am displaying and image, and then wanna display a masked one on top of it. If you switch to P3D, it works.

Any idea of workaround (provided I am NOT the bug) would be greatly appreciated.

Manuel
Page Index Toggle Pages: 1