Write Image To Depth Buffer

From OpenGL Wiki
Revision as of 05:02, 27 April 2011 by V-man (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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