Write Image To Depth Buffer

From OpenGL.org
Jump to: navigation, search

Use the glDrawPixels() command, with the format parameter set to GL_DEPTH_COMPONENT. You may want to mask off the color buffer when you do this, with a call to glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); .

You can read about depth buffer precision at http://www.opengl.org/wiki/Common_Mistakes#Depth_Buffer_Precision