Processing depth/stencil values.

I have a texture with Depth24Stencil8 format. Is there a way to process the values from it into the other texture with the same format?

I’d like to have some calculations of both depth and stencil to be done for the processing. Binding the texture to the ColorAttachment0 of the FBO gives me InvalidOperation error. I can’t find such a restriction in the specification. Maybe you can point me to it?

The depth can be optionally written using glFragDepth variable, but I’m not aware of a similar mechanics for stencil values.

You may have seen this but it came out earlier this week with the OpenGL 4.1 goodies:

Not sure if that’ll be a GL4/D3D11-GPU-only feature, as doesn’t look like anybody supports it yet…