Get world position from depth buffer

I have a buffer I am rendering gl_FragDepth (remapped to range 0-1) to a color buffer (instead of color) in OpenGL

I would like to, in a second pass, read this depth and use the x and y coordinates of the current fragment to re-calculate the world coordinates.

I'm rendering my scene to an FBO, then I screenquad this FBO's contents to the screen and during that render i'd like to find the worldspace coordinates I rendered with initially.

• Say, I notice you've asked three questions in the past half-day that boil down to computing the worldspace position of a fragment. Do you need separate answers to all three, or is your project evolving and you now need a solution only to this most recent version? If so, please feel free to edit your existing unanswered questions rather than creating new ones each time you change your approach. – DMGregory May 13 '18 at 13:27
• I've been making continuous changes and I haven't found a solution – Geklmintendon't of Awesome May 13 '18 at 14:47
• I'd recommend deleting all but one of your questions on the topic, so you can focus answers in one place. Having the information scattered between several posts means users might miss details that are important to solving your problem. – DMGregory May 13 '18 at 14:49
• the problem is that i'm not getting any attention, not that people don't read my posts when they click – Geklmintendon't of Awesome May 13 '18 at 14:54
• You asked in the middle of the night on a weekend for those of us in the west (which is a substantial portion of our userbase). Sometimes it takes a little patience. Nighttime and Sundays can both be a little quiet here, and it's not unusual for a question to go a few days before it gets answered. If you want to bump your question to get more eyeballs, editing it to clarify or include more useful information accomplishes this goal without adding clutter to the question list. – DMGregory May 13 '18 at 14:58