I have a scene I'm rendering using OpenGL ES in Android (using the Java libs). I want to apply some effects such as depth of field to the scene. I found a nice bokeh shader, and it needs a depth texture to do the job. What I need then, is to generate a depth texture to pass to the shader. I've been poking around the internet for a day and a half trying to figure this out, and can't seem to find a good example of how to generate a depth texture from an existing scene. It seems I need to do several passes, probably using an off screen render to a frame buffer, then generate a depth texture from that to pass to my bokeh shader to actually render the scene.
How do you generate a depth texture? A good working example would be much appreciated.