OK. I got the color and the depth each written to a different texture in an FBO. For the color texture I use
glTexImage2D (GL_TEXTURE_2D,0,GL_RGBA,400,400,0,GL_RGBA,GL_UNSIGNED_BYTE,NULL);
glFramebufferTexture2D (GL_DRAW_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,geom_color,0);
and for the depth texture I use
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT24,400,400,0,GL_DEPTH_COMPONENT,GL_FLOAT,0);
glFramebufferTexture(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,geom_depth,0);
At the end I bind the 0 frame buffer and draw 2 triangles that cover the entire window, using the color texture to draw them. Everything works fine.
Now I would like to use a shader to post-process my geometry. I have 2 textures: one with the color and one with the depth. I want to use both in the shader: I will look at the value of the depth using a filter to detect an edge (something I've already done outside of a shader and I know it works well) and, depending on the value of the filter, I will use either the color from the color texture or just set the color to black to highlight the edge (I'm not worried about the edge algorithm now).
My question is: how do I setup the shader to use 2 textures at the same time. I'm truly confused by this: one texture contains a vec4; the other a single float; and both are used in the shader at the same time.
If somebody could give me some pointers on what needs to be done in the client and the shader to use these 2 textures at the same time I would appreciate it.
Thanks.