What I want to do is pretty simple. I want to warp a texture based on depth information for that texture. These two textures are simultaniously(?) available in the fragment shader thanks to multitexturing (is there a better way?). My output texture (which will be mapped normaly on to a GL_QUAD) will have values from the original texture, but these values will be in different texture coords, thanks to the depth-based warping. The problem is I don’t have enough writing abilities from the fragment shader, since I am dealing with one fragment at a time. I would want to take a depth + color-value, warp it, assign the color to the warped texture coordinate in an image (optimally to the right fragment but this is not possible). I suspect this cannot be done using a fragment shader by itself, is this correct? This has lead me to look into GL_EXT_framebuffer_object and I am wondering if I could have access from my fragment shader to write to any position in the framebuffer (or are screen coordinates already decided in fragments? I suspect this), which can be retrieved, and mapped to geometry.
Am I clear enough? =)
A quite different approach is inverse relief texture mapping, where I for every fragment, look through the whole depth texture to see if any texels should be mapped to this fragment, a rather ineffective approach, but probably do-able.
Is GL_EXT_framebuffer_object even available from within a shader?
Comments and suggestions are much appreciated! =)