Back to the topic...as for how the various coordinate spaces relate to traditional OpenGL matrix types, I had to go look it up myself since I'm not really familiar with GL. Section 9.011 of the OpenGL FAQ seems to do a good job of explaining it all. According to that, what I call the "worldView" matrix is the same as your "modelView" matrix. In Direct3D, 3 matrices are used for projection instead of 2 (world, view, and projection respectively), whereas in GL the first two parts are combined into one matrix. The process goes something like this:
Object Coordinates are transformed by the World matrix to produce World Coordinates.World Coordinates are transformed by the View matrix to produce Eye (View-space) Coordinates.Eye Coordinates are transformed by the Projection matrix to produce Clip Coordinates.Clip Coordinate X, Y, and Z are divided by Clip Coordinate W to produce Normalized Device Coordinates.
Now for the first solution to your problem, getting world-space coordinates from a buffer filled with z/w values, you need a matrix that does the reverse of those last two steps (the inverse viewProjection matrix). But as you've indicated, you don't have a viewProjection matrix to start off with. This means you'll have to create it and invert it in your application, and then pass the matrix as a shader constant. Doing this isn't too hard, since you already have the projection matrix. You just need a view matrix as well. In direct3d I use a helper function for creating a view matrix, but if you don't have access to such a function in GL it's not a problem creating one. Just think about what a view matrix does: it takes coordinates that are in world space, then transforms them so that they are now coordinates relative to your camera's position and orientation. This means that if your camera is located at <0,10,0>, you must translate your original coordinate by <0,-10,0>. If the camera is rotated 90 degrees about the y-axis, the coordinate must be rotated -90 degrees about the same axis. So in other words, you must come up with a transformation matrix for your camera and then invert it. Then you can multiply this with your projection matrix, invert the product, and voila: an inverse viewProjection matrix.
[Edited by - MJP on December 2, 2007 6:10:29 PM]