I followed this tutorial (http://androidblog.reindustries.com/a-real-opengl-es-2-0-2d-tutorial-part-8-rendering-text/) to render text in opengl es 2.0 using a texture atlas (image with lots of little subtextures). So if I draw a text it's just a bunch of squares with mapped on textures from the texture atlas. I made a picture to illustrate the method:
The red boxes are just to show that there are individual squares with textures on them.
Now I wanted to mask this text to another square so that it looks something like that:
The things I draw before that shouldn't get masked, if theres a method that would do that. How would I accomplish that?
I already tried a stencil but this just masked the squares and not the texture on them. I also thought about making a shader that uses two sets of vertecies(square to be masked and square to be textured) and mask them, but I don't know if that is even possible.