Jump to content
Posted 03 March 2012 - 02:25 PM
Posted 03 March 2012 - 03:07 PM
Posted 03 March 2012 - 03:42 PM
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
Posted 03 March 2012 - 05:34 PM
Posted 03 March 2012 - 07:13 PM
Posted 04 March 2012 - 05:16 AM
You should just just be able to allocate a texture with an internal format of GL_DEPTH_COMPONENT, and call glCopyTexSubImage2D to copy the contents of the depth buffer into that texture. After that, you can render a fullscreen quad with the texture, or whatever else you want...
However, unless you are restricted to an ancient version of OpenGL, I would recommend using an FBO (Frame Buffer Object), to render the depth buffer directly to a texture in the first place. Or even a shader, to render the z coordinate into the colour buffer, and save having to render multiple passes at all.
Posted 04 March 2012 - 03:25 PM
I thought that since the Z-buffer exists somewhere (I assume, or things would overlap, and my clearing the depth buffer would affect nothing), I should be able to simply(??) swap it for the color buffer.
Posted 04 March 2012 - 04:22 PM
AFAIK, shaders can't access the depth buffer directly, either. FBOs are the only way to directly render to a texture (which texture can then be used by a shader).
The thing with that is that, for as far as I'm aware, the z-buffer is implemented (either by hardware or software) on the GPU. This means that the only direct way to get access to it is via shaders.