Polygon Masking


So, I’ve been trying to do this for the past few days:
I need to render a GL_POLYGON with it’s content masked.
glPolygonStipple() is exactly the function I need but unfortunately it’s not supported anymore.
Please note that I want to be able to change the color of the solid areas, so that I can load the pattern from a file but change it’s color dynamically.
I’m almost sure that the solution has to do with textures but I don’t know exactly what to do.

Thanks in advance,

I hope that I describe my problem correctly.

You can stick with GL 1.1 to 2.1 if you really want that function.
If you want to use modern GL, then you can use a texture that an alpha value or some specific value in the RGB layer. In your fragment shader, you just need to kill the fragment with the discard command.


etc etc.