Richard,
Apologies for the delay, but I had to go do my homework first...
I've looked into edge detection fragment shader and many, many questions came up. I was hoping somebody would be able to help me make sense of all this.
1) To start with, I need to access the z-buffer values in the frament shader; not only for the current pixel, but for adjacent pixels also. From what I understand the only way to access z-buffer information in the fragment shader for adjacent pixels is to have the z-buffer written to a texture.
Could somebody confirm this? Sounds like a silly thing, given that the z-buffer is already in the graphics card memory, so I figured there should be a way to access the data - adjacent pixels included.
2) Assuming a texture is indeed needed, then there are 2 parts (or more) to this procedure: (a) creating the texture - i.e., the client code - and (b) using it in the shader. Can somebody show me the necessary client steps I will need to generate the texture? Also, as I rotate my model and redraw, I assume the texture I am creating gets automatically updated with whatever I do. Is this the case?
3) I think that once I get the client code done I can probably figure out what goes in the fragment shader, but if somebody has already done something similar and can give me a head start I would truly appreciate it.
Thanks.