write stencil buffer

I want to write the stencil buffer in a atactic shape. I can’t figure out the shape before hand. the only way by which I can figure out the shape is the alpha test. Can I write the stencil buffer by the alpha value but not the polygon that I draw?
Thanks.

I’m no expert on the stencil buffer, but I think in your case you could use the alpha test to filter what fragments are drawn to the stencil buffer. Anything which fails the alpha test should not affect the stencil when that test is activated.

sounds like u dont need stencil at all, perhaps blending using src_alpha or dst_alpha is what u want