Masking in JOGL

Hi there,

This is probably a really simple question: but I’m struggling to work out how to do this.

I have a B&W geometric Texture that’s been generated by Processing and GLTexture. At present, it’s simply a white square on a black field.

I’d like to use this texture to mask another Texture. I’d like the second Texture to render normally when it’s on top of the white square, but simply be black when on the black field.

I’ve found a couple of examples that seem to be similar, but they’re much too complex for me to follow: and do much more than I need.

Edit: I’ve got this working wonderfully, with one caveat! Where the second Texture is being placed, the colour present is white. I’d like this to be black. How would I change this?

Cheers,
Will.