OpenGL: Draw a depth texture to depth buffer
I am programming a 2D videogame which must be suitable for almost any Windows system, including older ones. I have my scene drawn and in some point, I am retrieving the color and depth buffer each to its own texture with glCopyTexSubImage2D. I can draw the color buffer again in subsequent frames, but when I try to draw the depth buffer it is drawn as a grayscale color texture. I want it to be written to the screen depth buffer.
I have tried a lot of things. I tried with a FrameBuffer Object. It worked on some systems, but not on older ones. I want the solution to be suitable for all systems, because I am doing this precisely to boost performance on slower systems, so it doesn't make sense to use a FBO.
I have tried with readpixels and writepixels. Again, on newer systems it works, but it is incredibly slow on older systems.
I need simply to draw that depth texture to the screen depth buffer. Is this really so hard?
Please, help! Thank you very much.
Re: OpenGL: Draw a depth texture to depth buffer
Did you try binding the depth texture as the depth buffer of an FBO?