Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Using texture as alpha mask to apply transparency

$
0
0

@Gallo wrote:

hello,

i have read a lot of thread about this but i can't make it to work !
i would like to stack 2 images and apply a mask to the top level one to see the bottom layer through it :

load 2 images
load a Grayscale image as a mask
apply mask to image1
draw image2
draw image1 to see image2 through the mask of image1

ofFbo imgFinal;

ofImage imgFront;
ofImage imgBack;
ofImage mask;

imgFront.load("1.jpg");
imgBack.load("2.jpg");
mask.load("mask.jpg");

imgFront.getTexture().setAlphaMask(mask.getTexture());

imgFinal.allocate(640, 480, GL_RGBA);
imgFinal.begin();
imgBack.draw(0, 0);
imgFront.draw(0, 0);
imgFinal.end();

// front

// back

// mask

// expected

// what i have

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Latest Images

Trending Articles



Latest Images