Shader mask FBO texture according vector of coordinates

Hi,

I’m currently drawing into and ofFbo a texture recorded from a kinect.
Thanks to ofxFaceTracker I’m able to get texture coordinate vector which represent the user face coordinate on the texture.
Long story short, I want to remove everything drawn on the fbo except the the user face.

Technics I was thinking about :

  • Using these coordinates I want to simply discard (draw black) the current texture pixel processed inside the fragment shader if he is outside the face coordinates. (Use a lookup texture to pass vector to fragment shader)

  • Create at 2d mesh with the face coordinate and map the texture on it

  • Create at each frame a ofImage and use it as an alpha mask (i.e : white = inside the face - black = outside the face) and use it inside my fragment shader to multiply it with the current color.

I don’t know what solution is the best / or if you guys think about a cleaner / easier solution.

Regards