Is it possible to write information directly into the Z-buffer and/or stencil buffer? I need to copy some color values from one imgaes into the Z-buffer as Z-buffer values. Then I need to draw another picture doing depth-tests with these values. It seems that functions like glCopyPixels and glReadPixels can read Z-buffer data and then convert them into colors but not the other way around. Can this be done?
Any help is appreciated