title: How can I use a binary image to mask augmented reality with OpenGL and ARcore?
body: <p>I need to render only some part of virtual object like in this image where part of Android Robot is hidden <a href="https://i.stack.imgur.com/4pWR8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4pWR8.jpg" alt=""></a></p>
  
  <p>For doing this I use "Stencil Testing" and i draw with OpenGL a simple rectangle. 
  The problem is that now I need the part "hidden" to be not static but dynamic and I have to choose the part to hidden from a binary image like this one <a href="https://i.stack.imgur.com/xQyOq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xQyOq.png" alt=""></a> where the black part needs to "hide" (like in the example before) the virtual object and virtual plane. The "mask" will be changed for every frame.</p>