How can I implement texture thresholding in a nice way?
I have a B/W texture (read from the framebuffer with glCopyTexSubImage) that I would like to write back to the framebuffer using thresholding.
I would like to be able to implement:
fragment >= threshold -> color 1 (white)
fragment < threshold -> color 2 (black or background)
I think one way would be to use alpha testing, but I don’t have the alpha channel.
[Edit:] Can I copy from the color buffer (e.g. the red channel) to the texture alpha channel by using the color matrix extension (I know I can, but is it widely supported in hardware?).
Also, I would like to avoid fragment programs and register combiners. Multitexturing is OK though.
[This message has been edited by marcus256 (edited 04-15-2003).]