Stencil test for sprite collision. Help


I want to code a stencil test. But dont have occlusion query
available since it shall also run on opengles.

So the current idea is to work with the stencil buffer, draw
first sprite, then change stencilfunc and draw second.

After that I read out with glreadpixels. But then i have problems with alpha sections e.g.

Any better idea?


Use alpha test, to skip “alpha sections”.